Authentication Issue with Azure Cloud Shell
When launching a new Azure Cloud Shell session, my credentials are sometimes rejected for certain Az
cmdlets but not for others. The command Get-AzContext
shows that my account is MSI@50342
as expected. Examples of cmdlets that do not work include Get-AzRoleAssignment
and Get-AzADOrganization
. Running these commands results in the following error:
ManagedIdentityCredential authentication failed: Service request failed.
Status: 400 (Bad Request)
Content:
{"error":{"code":"invalid_request","message":"Timeout waiting for token from portal. Audience: https://graph.microsoft.com/"}}
Running Disconnect-AzAccount
and then reconnecting with Connect-AzAccount -Identity
results in the same issue. This issue does not happen consistently but when it does, the cmdlets that work/don't work are the same.
Debug and verbose options offer do not help.
I cleared some cookies from azure.com and that seemed to fix things, but I don't know if that was coincidence. Does anyone have any insight into this? And please note that I am able to use chatgpt and Q&A assist by myself, so there is no need to post that for me.