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

Pankaj Joshi 286 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.
384 questions
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.
666 questions
Azure Policy
Azure Policy
An Azure service that is used to implement corporate governance and standards at scale for Azure resources.
793 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,867 questions
{count} vote

Accepted answer
  1. Alberto Morillo 32,886 Reputation points MVP
    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 [bob@contoso.com] FROM EXTERNAL PROVIDER;  
      CREATE USER [alice@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