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.
Unable to import Azure SQL database with Service Principal
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.
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?
@Filip Bieleszuk Thank you for reaching out.
My understanding is that you are trying to import or export your SQL Server or Azure SQL Database.
Could you please check if the service principal is not expired.?
The SqlPackage command line tool allows you to specify these actions along with action-specific parameters and properties.
SqlPackage authenticates using methods available in SqlClient. Configuring the authentication type can be accomplished via the connection string parameters for each SqlPackage action (
/TargetConnectionString) or through individual parameters for connection properties. The following authentication methods are supported in a connection string:
- SQL Server authentication
- Active Directory (Windows) authentication
- Azure Active Directory authentication
- Integrated authentication
- Universal authentication
- Managed identity
- Service principal
Please note for Azure SQL Managed Instance does not currently support exporting a database to a BACPAC file using the Azure portal or Azure PowerShell. To export a managed instance into a BACPAC file, use SQL Server Management Studio (SSMS) or SQLPackage.Regards,
Sign in to comment