Reputation: 2208
We created an Azure VM with a user-assigned managed identity as described here.
The following environment variable was exported, so the Azure CLI uses a proxy (direct internet connection is blocked in our subnet).
export http_proxy="http://proxy.local:111"
export https_proxy="http://proxy.local:111"
Now I would like to use az login --idenity
to login to Azure with the assigned managed identity.
Unfortunately, I receive all the time the following message:
Failed to connect to MSI. Please make sure MSI is configured correctly.
Get Token request returned http error: 400, reason: Bad Request
Upvotes: 2
Views: 1134
Reputation: 2208
Using az login --identity --verbose --debug
we observed, that az login --identity
performers the following call:
...
urllib3.connectionpool: http://proxy.local:111 "GET http://169.254.169.254/metadata/identity/oauth2/token?resource=https%3A%2F%2Fmanagement.core.windows.net%2F&api-version=2018-02-01 HTTP/1.1" 400 68
...
Because of the proxy settings, az login --identity
is trying to connect to 169.254.169.254
over the configured proxy, which will not work. Setting export no_proxy="169.254.169.254"
resolved the issue.
Upvotes: 2