Hello
You're encountering the error "Login failed for user '<token-identified principal>'" when deploying a DACPAC to an Azure Synapse serverless SQL pool via Azure DevOps using a service principal. This issue typically arises due to authentication or permission configurations specific to Azure Synapse serverless pools.
The error message indicates that the service principal lacks the necessary permissions to authenticate against the serverless SQL pool. In Azure Synapse, serverless SQL pools require that any Azure Active Directory (Azure AD) principal, including service principals, be explicitly created within the SQL pool before they can authenticate and perform operations.
Recommended Steps to Resolve
- Create the Service Principal User in the Serverless SQL Pool Connect to the serverless SQL pool using an account with administrative privileges and execute the following T-SQL command to create a user for the service principal:
CREATE USER [<service-principal-name>] FROM EXTERNAL PROVIDER;
Replace <service-principal-name>
with the display name of your service principal.
- Assign Appropriate Roles to the Service Principal After creating the user, grant the necessary permissions by adding the user to appropriate database roles. For example:
ALTER ROLE db_owner ADD MEMBER [<service-principal-name>];
Adjust the role (db_owner
in this example) based on the level of access required for your deployment.
- Verify Azure AD Admin Configuration Ensure that an Azure AD admin is configured for your Synapse workspace. This is necessary to manage Azure AD users and service principals within the SQL pool. Check Firewall and Network Settings Confirm that your Azure DevOps environment can connect to the serverless SQL pool. Ensure that firewall rules allow access from Azure services, or specifically from the IP ranges used by Azure DevOps.
- Review Token Expiry Settings Service principal tokens have a default expiration time (typically 1 hour). If your deployment process takes longer, consider refreshing the token or adjusting the token lifetime