Access to Azure Keyvault inside Azure Container Instance WebApi

2024-06-03T18:27:48.5266667+00:00

I would like to retrive the keyvault secrets using managed identity in web Api.

  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 azure container instace using above image
  6. Provided Key Vault Reader and Key Vault Secrets User by slected the instance using managed identity
  7. When I try to access the API that reads the data from AzureKeyVault, it is giving 404 erro.

ManagedIdentityCredential authentication failed: DefaultIdentityNotDefined \r\nStatus: 404 (Not Found)\r\nErrorCode: DefaultIdentityNotDefined\r\n\r\nContent:\r\n{\r\n "error": {\r\n "code": "DefaultIdentityNotDefined

How can I access the keyvault data inside container instace web api?

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,175 questions
{count} votes

Accepted answer
  1. Miguel Fernández Corral 190 Reputation points
    2024-06-03T19:13:02.8033333+00:00

    Hello, review your Identity in each resource. Enable system assigned identity on both, or user assigned with the right permissions if required.

    Regards,

    Miguel.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful