azure app container to Azure SQL - login failed <token-identified principal

Pankaj Joshi 411 Reputation points
2022-10-01T14:41:30.26+00:00

I have container running on azure app service trying to access Azure Sql server but getting below error:

PMLogin failed for user '<token-identified principal>'. ClientConnectionId:8d2425d8-1eeb-45c5-b91a-a3f04167w290

How do i allow azure app container to connect azure sql successfully, Am I missing any configuration?

Azure SQL Database
Azure Container Registry
Azure Container Registry
An Azure service that provides a registry of Docker and Open Container Initiative images.
Azure Role-based access control
Azure Role-based access control
An Azure service that provides fine-grained access management for Azure resources, enabling you to grant users only the rights they need to perform their jobs.
Azure Policy
Azure Policy
An Azure service that is used to implement corporate governance and standards at scale for Azure resources.
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
{count} vote

Answer accepted by question author
  1. Alberto Morillo 35,401 Reputation points MVP Volunteer Moderator
    2022-10-02T01:24:50.51+00:00

    Please make sure the Azure Active Directory user is created on the Azure SQL Database. Please make you create the user in the Azure SQL Database following the steps mentioned here.

    To create an Azure AD-based contained database user, connect to the database with an Azure AD identity, as a user with at least the ALTER ANY USER permission. Then use the following Transact-SQL syntax:

      CREATE USER <Azure_AD_principal_name> FROM EXTERNAL PROVIDER;  
      CREATE USER [******@contoso.com] FROM EXTERNAL PROVIDER;  
      CREATE USER [******@fabrikam.onmicrosoft.com] FROM EXTERNAL PROVIDER;  
    

    Make sure you are connect to the Azure SQL database and not to the master database on the Azure SQL logical server.

    0 comments No comments

0 additional answers

Sort by: Most helpful

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.