Creating Contained Database Users for Azure AD Authentication
In this section, you will learn how to create contained database users for Azure AD authentication for firms such as ToyStore Ltd., where there are many roles that require access to the database:
- Open SSMS. From the top menu, select File, select New, and then select Database Engine Query to open a new query window:
Figure 5.29: SSMS
- Connect to the Azure SQL Server with Active Directory – Password authentication.
- Execute the following query to create a contained database user (SQL authentication) and add it to the db_owner role:
--Create a contained database user (SQL Authentication) CREATE USER Mike WITH PASSWORD='John@pwd'
GO
-- Make Mike toystore database owner ALTER ROLE db_owner ADD MEMBER Mike
- Execute the following query to create a contained database user (Azure AD authentication) and add it to the db_datareader role:
--Create a contained database user (Azure AD Authentication)
CREATE USER [John...