Windhoek
Windhoek

Reputation: 1921

Different passwords for SQL Azure databases

I have an Azure account within which I'm running 2 SQL Azure databases. Each database is housed under the same "SQL Server".

I wish to add a 3rd database, but I want to use a different login/password for this database. Is this possible without adding a new "SQL Server"?

Upvotes: 1

Views: 624

Answers (1)

juunas
juunas

Reputation: 58723

The server in Azure SQL is essentially a management boundary. It provides the URL for the databases, as well as admin credentials. Whoever has those admin creds can manage every database within the server.

But if you want separate accounts, you can create them. Here's a few T-SQL statements that will create one:

--Connect to the Master DB
CREATE LOGIN Mary WITH PASSWORD = '<strong_password>';
--Connect to the DB you want to add the user to / Master if you are making an admin user
CREATE USER Mary FROM LOGIN Mary;
--Grant permissions, add to roles
ALTER ROLE db_owner ADD MEMBER Mary;

Read more here: https://learn.microsoft.com/en-us/azure/sql-database/sql-database-manage-logins

Also note db_owner role can do anything in that database. You may want to make it a bit stricter. You can read more about SQL Server permissions here: https://msdn.microsoft.com/library/ms191291.aspx.

Upvotes: 6

Related Questions