Azure CLI: get object id from user name or email address
<p>I'm trying to automate detection of current user's oid using Azure CLI in order to perform queries on my application data. If I use the command <code>account show</code>, I get this: </p>

<pre><code>azure account show
info:    Executing command account show
data:    Name                        : Visual Studio Enterprise
data:    ID                          : 12345678-1234-1234-1234-123456789012
data:    State                       : Enabled
data:    Tenant ID                   : abcdef12-abcd-1234-abcd-1234abcd1234
data:    Is Default                  : true
data:    Environment                 : AzureCloud
data:    Has Certificate             : No
data:    Has Access Token            : Yes
data:    User name                   : peter.parker@outlook.com
data:
info:    account show command OK
</code></pre>

<p>Look at <code>peter.parker@outlook.com</code>. Now if I use the command <code>ad user list</code>, I get this:</p>

<pre><code>azure ad user list
info:    Executing command ad user list
\data:    Object Id:       9123abcd-ffee-dafa-d0fa-abacfede1234
data:    Principal Name:  peter_parker_outlook.com#EXT#@peter_parkeroutlook.onmicrosoft.com
data:    Display Name:    Peter Parker
data:    E-Mail:
data:
+
info:    ad user list command OK
</code></pre>

<p>The principal name is <code>peter_parker_outlook.com#EXT#@peter_parkeroutlook.onmicrosoft.com</code>. It doesn't match.</p>

<p>Any idea on how can I get the current user's object id?</p>