Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure SQL Server, is it possible to disable server admin (after creation)?

Case

I want to work with Azure SQL Server, as noted in the best practices how to secure Azure SQL Server it is good to use AAD account for accessing your server/database instead of SQL Accounts.

I read several posts on the documentation site of Microsoft and blogs, but I cannot find that it is possible to disable/remove the Server Admin account, after you have the Azure SQL Server and an created AAD SQL Administrator and attached it to Azure SQL Server.

I know Server Admin Login and Password is mandatory, when you create the Azure SQL, but I hoped it was possible to delete after creation of server and AAD SQL Admin.

Why do I want this?

  • There are enough companies who have to rule (inherited from the on-prem) that accounts must be controlled by a centralized Identity Store, such as AAD.
  • Password rotation must be done, it is a lot easier when you have a centralized identity Store instead that you have to do it for a lot of Azure SQL Servers.

Question

Is it possible to disable the SQL Server Admin (sql account)?

like image 730
Sven Avatar asked Jul 19 '18 21:07

Sven


People also ask

Can we stop Azure SQL managed instance?

In general, we can't stop Azure SQL Databases.

How do I change the admin on an Azure SQL Server?

On the SQL Server page, select Active Directory admin. In the Active Directory admin page, select Set admin. In the Add admin page, search for a user, select the user or group to be an administrator, and then select Select.

Can I turn off an Azure SQL Database?

In the Azure portal, choose your MySQL server that you want to stop. From the Overview page, click the Stop button in the toolbar. Once the server is stopped, the other management operations are not available for the single server.

How do I restrict access to Azure SQL Database?

In the Azure portal, select SQL databases from the left-hand menu, and select your database on the SQL databases page. In the Security section, select Transparent data encryption. If necessary, set Data encryption to ON. Select Save.


2 Answers

I don't believe it is (or can be) possible to disable the SQL Server Admin.

The Azure Subscription Owner and the AAD SQL Admin identity have joint ownership of the Azure SQL Server. Either one needs to be able to re-acquire administrative access to the server.

And the mechanism that the Azure Subscription Owner uses to force their way into their own database is to reset the SQL Server Admin password from the Azure Portal.

This is roughly analogous to how a Windows Administrator can force sysadmin access to a SQL Server by starting the service in single-user mode.

I think the best you can do is to throw away the SQL Server Admin's password, so no one could log in using that account without first resetting the password in the portal. EG run:

declare @sql nvarchar(max) = concat(N'alter LOGIN [youradmin] WITH PASSWORD=N''',newid(), N'''')
exec (@sql)
like image 88
David Browne - Microsoft Avatar answered Oct 04 '22 19:10

David Browne - Microsoft


Update 06/21: Microsoft released Azure Active Directory only authentication for Azure SQL which effectively disables the possibility to use any SQL user for authentication.

Note the caveats

  • Azure AD-only auth is supported at the Azure SQL server level
    • This means that when this mode is enabled, all databases that belong to this server can only be accessed using Azure AD authentication
  • Enabling Azure AD-only auth does not remove existing SQL logins or SQL users based on these logins. They continue being stored in SQL metadata, but cannot be used for SQL authentication
  • Even though the Azure AD-only auth is enabled, with proper SQL permissions for Azure AD users, SQL logins and SQL users can be created. However, the authentication process to connect to Azure SQL using SQL logins/users will fail
  • Azure AD users with proper permissions can impersonate existing SQL users
    • Impersonation continues working between SQL authentication users even though the Azure AD-only auth feature is enabled. This is consistent to the way impersonation works today, where even disabled users can be impersonated.

Microsoft is working on allowing so called "AAD-only authentication" which will effectively disable the server admin login, as the complete SQL authentiction is disabled.

like image 20
Marvin Dickhaus Avatar answered Oct 04 '22 20:10

Marvin Dickhaus