Unable to import Azure SQL database with Service Principal

Filip Bieleszuk 0 Reputation points


I have Azure SQL Server with Azure Active Directory authentication only setting enabled

Azure Active Directory admin is a Service Principal.

I am not able to restore database from backup when providing Service Principal name as Active Directory admin user name and its secret as Password.

Received error:

An error occurred while communicating with the SQL Server using AdPassword-login: Could not discover a user realm.

I am getting the same error both from Azure Portal and when using Azure CLI to restore the database.

At the same time I can use above Service Principal in Azure DevOps Pipelines to connect to database without any issues.

Would you be able to help with that?

Best regards,


Azure SQL Database
{count} votes

1 answer

Sort by: Most helpful
  1. Alberto Morillo 32,786 Reputation points MVP

    As you can read on this forum thread, Azure users have reported through the years that Import-Export operations with a service principal does not work. You always get the error you shared with us.