How to fix 'code': 400, 'message': 'Failed to get managed identity token.'?

Lorentz Yeung 35 Reputation points
2024-10-06T17:48:17.42+00:00

Hi folks!

I am new to Azure AI web app deployment and currently testing out a simple chatbot web app. In the Azure AI Studio playground, I selected a deployed LLM model and added Retrieval-Augmented Generation (RAG), then deployed it using the "Deploy as a web app" button.

After numerous tweaks and configuration adjustments, I successfully deployed the web app and can access it via the URL: https://myapp.azurewebsites.net/. However, when I try to interact with the chatbot, I encounter an error.
Screenshot 2024-10-06 184109

Error
Error code: 400 - {'error': {'requestid': 'b1f2f881-0777-4380-b900-73bacd68c20d', 'code': 400, 'message': 'Failed to get managed identity token. Response: {"error":{"code":"ManagedIdentityIsNotEnabled","message":"Managed Identity (MI) is not set for this account while the encryption key source is \'Microsoft.KeyVault\', customer managed storage or Network Security Perimeter is used."}}'}}

I have already configured my app authentication by following this https://learn.microsoft.com/en-us/azure/ai-studio/tutorials/deploy-chat-web-app to configure app authentication, and I have assigned the Key Vault Secrets User role to the web app's Managed Identity to allow access to Azure Key Vault for retrieving secrets. Despite following the steps (though the tutorial seems somewhat outdated), the issue persists.

Could you please assist me in resolving this error? I believe there may be some additional configuration required.

Thank you for your help!

Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
Microsoft Security | Microsoft Entra | Microsoft Entra ID
{count} votes

2 answers

Sort by: Most helpful
  1. Barry Briggs 115 Reputation points
    2024-12-16T21:39:34.8033333+00:00

    I encountered this problem as well but only had to populate  AZURE_SEARCH_KEY with the key from the Azure AI Search service and it worked.

    1 person found this answer helpful.
    0 comments No comments

  2. Ido Burstein 0 Reputation points Microsoft Employee
    2024-10-23T19:20:31.6366667+00:00
    0 comments No comments

Your answer

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