title: az account get-access-token - fails to fetch token in user's context
body: <p>I have a user managed identity, for which I want to generate a token</p>
  <p>I tried in user's context</p>
  <pre><code>az login
  az account get-access-token --resource &quot;&lt;client-id of user managed identity&gt;&quot;
  </code></pre>
  <p>I get the error</p>
  <pre><code>Get Token request returned http error: 400 and server response: {&quot;error&quot;:&quot;invalid_grant&quot;,&quot;error_description&quot;:&quot;AADSTS65001: The user or administrator has not consented to use the application with ID '04b07795-8ddb-461a-bbee-02f9e1bf7b46' named 'Microsoft Azure CLI'. Send an interactive authorization request for this user and resource.
  </code></pre>
  <p>Regarding the above error, I have come across threads which suggest to add Azure CLI as <code>preAuthorizedApplication</code>. However I did not find this managed identity in <code>App Registrations</code>I did find an entry in `Enterprise Applications, but did not find how to pre-authorize Azure CLI here.</p>
  <p>I tried to achieve the same in a non-user context</p>
  <pre><code>az login --service-principal -u &lt;capp-id&gt;  -p &lt;client-secret&gt; --tenant &lt;tenant-id&gt;
  az account get-access-token --resource &quot;&lt;client-id of user managed identity&gt;&quot;
  </code></pre>
  <p>This works.</p>
  <p>Why does the command fail in user context? How can I make it work?</p>