Created a User Assigned Managed Identity Azure Resource
I deployed the Container Group with User Managed Identity as shown below:
Provided access to User Identity for a given Keyvault
Now when I am trying to access the keyvault using the following C# code, its throwing exception:
Exception Error loading KV settings:: One or more errors occurred. (Parameters: Connection String: [No connection string specified], Resource: https://vault.azure.net, Authority: https://login.windows.net/xxxxxxxxx. Exception Message: Tried the following 3 methods to get an access token, but none of them worked. Parameters: Connection String: [No connection string specified], Resource: https://vault.azure.net, Authority: https://login.windows.net/xxxxxx. Exception Message: Tried to get token using Managed Service Identity. Unable to connect to the Managed Service Identity (MSI) endpoint. Please check that you are running on an Azure resource that has MSI setup. Parameters: Connection String: [No connection string specified], Resource: https://vault.azure.net, Authority: https://login.windows.net/xxxxx. Exception Message: Tried to get token using Visual Studio. Access token could not be acquired. Environment variable LOCALAPPDATA not set. Parameters: Connection String: [No connection string specified], Resource: https://vault.azure.net, Authority: https://login.windows.net/xxxxxxxx. Exception Message: Tried to get token using Azure CLI. Access token could not be acquired. )
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: f4bb823e-1c72-5777-bdd6-e89942c4f470
- Version Independent ID: eb046e79-f39c-dcca-fbd4-519c0a320201
- Content: Enable managed identity in container group - Azure Container Instances
- Content Source: articles/container-instances/container-instances-managed-identity.md
- Service: container-instances
- GitHub Login: @macolso
- Microsoft Alias: macolso
var azureServiceTokenProvider = new AzureServiceTokenProvider("RunAs=App;AppId={ClientId of user-assigned identity}");
. – Joy Wang-MSFT