I need to replace my old admin login/user with a new one. I tried the following:
CREATE LOGIN newDbAdmin WITH password='123isTheBestPasswordEver'
CREATE USER newDbAdmin
With this I'm then also able to log into Azure SQL via Microsoft SQL Server Management Studio. However it doesn't seem to be an admin level login+user. I'm unable to create tables and a few other things that admins can do. I suspect I need to GRANT permissions to certain schemas (dbo?) or something along those lines ...
So, what's the right way to create user+login on Azure SQL with the same level of privileges as the original admin (created when I create the DB via the Azure portal site).
On a related note, I assume the proper way to dispose off the old login is:
DROP USER oldAdmin
DROP LOGIN oldAdmin
?
you just created a login and a corresponding user, you have to add the appropriate role memberships...
e.g.,
EXEC sp_addrolemember 'dbmanager', 'login1User';
EXEC sp_addrolemember 'loginmanager', 'login1User';
see: https://azure.microsoft.com/documentation/articles/sql-database-manage-logins/
You can use Azure AD to manage the server. Create a DBA group - assign all DBAs to that group. Then assign the group as the AD Manager for the server - that allows you to have multiple DBAs
Anyone in that group will have full DBA permission over the server.
https://docs.microsoft.com/en-gb/azure/sql-database/sql-database-aad-authentication
Ideally, I think they expect you to use DB level contained users granted by a DBA. For us, we needed multiple admins as we have a lot of databases.
You can only have one server-level admin. You can create as many other logins and users as you like but they need to be granted access to the individual databases separately. You can reset the password for the server-level admin via the azure portal.
There's no server role in Azure SQL Database that grants access to all databases.
dbmanager
lets you create databases,loginmanager
lets you create logins, but the server-level principal login must be used to grant access to individual databases.To create a new user and give dbo rights to one or more databases:
And yes, you drop users in the same way you would in on-premises sql.
If you wanted to make a new user as dbo on all databases on a server you can use a little powershell to make your life easier: