Assigne user assigned managed identity to Container Instance

2024-06-06T21:06:25.8066667+00:00

Hi Team,

I am trying to access azure keyvault inside my container instance app. However, I am not getting the proper response.

  1. Creates Web APi with DefaultAzureCredential
  2. User's image
  3. Able to retrive the data using aboe code.
  4. Built image and pushed into Azure container registry
  5. Created user defined managed identity
    1. az identity create --resource-group "POCRG" --name "AcIdSample20240530101995"
  6. Provide keyvault secret user role to above identity
  7. Created a container and assigned above identity
    1. az container create --resource-group "POCRG" --name "democmdapi-userassigned" --image "sample20055.azurecr.io/net5:latest-windows-cosmos-v2" --assign-identity "/subscriptions/f9356ed2-112486e/resourcegroups/POCRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/AcIdSample20240530101995" --os-type "Windows" --registry-username "Sample02055" --registry-password "2ITH1E7gn0oujgaZ+ACRA+SoJX" --dns-name-label "api-dem-az2-user-assigned" --ip-address "Public"
  8. When I try to access the application, it is giving an error
  9.    ManagedIdentityCredential authentication failed: DefaultIdentityNotDefined \r\nStatus: 404 (Not Found)\r\nErrorCode
    
Azure Key Vault
Azure Key Vault
An Azure service that is used to manage and protect cryptographic keys and other secrets used by cloud apps and services.
1,455 questions
Azure Container Instances
Azure Container Instances
An Azure service that provides customers with a serverless container experience.
758 questions
Microsoft Security | Microsoft Identity Manager
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.