I failing to set the Microsoft Entra admin for my Azure SQL server "Failed to set the Microsoft Entra admin for serverName: xxxxxx"

jimzim 11 Reputation points
2025-03-17T08:31:32.95+00:00

Using the Azure Portal, I checked in IAM and my logged in user is "Owner" for the Azure SQL server, but I am still unable to set the Microsoft Entra admin to my user, it keeps failing with the error "Failed to set the Microsoft Entra admin for serverName: xxxxxxxx" (where xxxx is the name of my server)

Azure SQL Database
{count} votes

2 answers

Sort by: Most helpful
  1. PratikLad 720 Reputation points Microsoft External Staff
    2025-03-20T12:23:35.8733333+00:00

    Hello James R

    As Saraswathi Devadula mentioned in the comment the Microsoft Entra admin is stored in the server's master database as a user (database principal). Since database principal names must be unique, the display name of the admin can't be the same as the name of any user in the server's master database. If a user with the name already exists, the Microsoft Entra admin setup fails. But you have issue with login as that user in order to get access to the Azure SQL server instance.

    To work around the issue, you can create a Service principal (App registration) to temporarily login into the database and rename or drop the existing SQL user.

    • First create an app registration from Microsoft Entra Id >> App Registration >> New Application.

    enter image description here

    • After creating application create client secret and store it to use it as password.

    enter image description here

    • Then Add this Service principal as Microsoft Entra admin.

    enter image description here

    • Login With Service Principal authentication, enter the client ID in the User name field and the secret in the Password field.

    enter image description here

    • After successful login alter the username that causing error while adding Microsoft Entra admin.
    
    ALTER USER [******@domain.com] WITH NAME = [******@domain.com1];
    
    GO
    
    

    This command will rename the azure SQL user.

    • Now, you can remove the service principal as admin and set the appropriate user as Entra admin.

    enter image description here


  2. Oury Ba-MSFT 20,716 Reputation points Microsoft Employee
    2025-04-09T22:25:32.2633333+00:00

    jimzim, James R,

    User's image

    Authorize server and database access using logins and user accounts - Azure SQL Database & SQL Managed Instance & Azure Synapse Analytics | Microsoft Learn The name of the server administrator can't be changed after the server has been created.

     You can create a new server as a geo replica for this server, replicate all the databases and then failover to that server? Once the failover is completed, you can break the link, drop the server, and start using the new one as your server. See Failover groups overview & best practices - Azure SQL Database | Microsoft Learn; on the secondary server you can configure the right Entra administrator and use a different account for SQL administrator.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.