azure-sql-managed-instanceazure-managed-database

Azure SQL MI: The requested server principal already exists on Managed Instance


In my SQL MI i have a ad group (called Group A) which was already assigned to the Active Directory Admin through Portal. I'm trying to update/replace that with a new group called Group B.

When I tried I get the error like

{"error":{"code":"ServerPrincipalAlreadyExists","message":"The requested server principal already exists on Managed Instance. Consider dropping the server principal and retrying operation."}}.

When I tried to add another new group called Group C it works. But the issue with Group B still exist

Questions:

P.S I tried by removing the existing group from the active directory admin and add the new group B still the same issue


Solution

  • You need to check whether group B exists among service_principals and drop it. You can check that by looking at server_principals table https://learn.microsoft.com/en-us/sql/relational-databases/system-catalog-views/sys-server-principals-transact-sql?view=sql-server-ver15. If it exist you need to drop sp(probably you added it as a login and thus it is server principal).