ManagedIdentityCredential not working from Container Instance

Steve Hayles 6 Reputation points
2021-02-12T18:20:20.34+00:00

Using Azure.Identity SDK 1.3 in an Azure Container Instance fails when trying to use a managed identity with the message "ManagedIdentityCredential authentication unavailable: No Managed Identity endpoint found"

Enabling a System Managed Identity from the portal appears to work and the identity is available in Azure AD as expected. The container instance does not contain the environment variables "MSI_ENDPOINT" and "MSI_SECRET" which appear to be set automatically when trying something similar from an App Service

Is this supported, should the endpoints be set specifically via Environment Variable or in code ?

Azure Container Instances
Azure Container Instances
An Azure service that provides customers with a serverless container experience.
646 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,697 questions
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. JamesTran-MSFT 36,461 Reputation points Microsoft Employee
    2021-02-17T00:12:55.48+00:00

    @Steve Hayles
    Thank you for your post and I apologize for the delayed response!

    When it comes to using Managed Identities from a Container Instance, are you able to share any documentation that you followed to enabled this? This way I can gain a better understanding of our issue. I've also reached out to our AKS team regarding this so they can take a look into this issue as well.

    Additional links:
    How to use managed identities with Azure Container Instances
    Is there support for Azure Kubernetes Containers?
    Updating to version 3 throws "No managed identity endpoint found" with managed identity
    AKS 1.15.11 getting : ManagedIdentityCredential authentication unavailable, no managed identity endpoint found when using eventhub
    Azure Container Instance - Managed Identity not available when container first deployed or restarted
    https://github.com/Azure/azure-sdk-for-net/blob/8d38ce2bc8eaa0a34d053ae94f03bbae6f7ee1c0/sdk/identity/Azure.Identity/src/ImdsManagedIdentitySource.cs#L31

    If you have any other questions or would like to work with our support team to get this issue resolved, please let me know.
    Thank you for your time and patience!