How do I solve this error?
az account get-access-token --resource https://cognitiveservices.azure.com
Failed to connect to MSI. Please make sure MSI is configured correctly.
Get Token request returned: <Response [400]>
When I ran same command as you in Azure Cloud Shell, I got same error as below:
az account get-access-token --resource https://cognitiveservices.azure.com
Response:
To resolve the error, you need to run az login
first and connect with vaild identity(user account) like below:
az login --only-show-errors
Response:
When I ran below command again after signing in with valid user account, I got access token successfully like this:
az account get-access-token --resource https://cognitiveservices.azure.com
Response:
I executed the same commands in my local environment too and got an access token successfully like below:
az login
az account show
az account get-access-token --resource https://cognitiveservices.azure.com
Response:
In your case, check how you are connecting to Azure from CLI and make sure to sign in with valid identity while running az login
.