Skip to content

Commit f2b93bd

Browse files
committed
edits according to Mushahid
1 parent 61b1837 commit f2b93bd

File tree

2 files changed

+42
-42
lines changed

2 files changed

+42
-42
lines changed

articles/azure-sql/database/authentication-azure-ad-logins-tutorial.md

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,49 @@ In this tutorial, you learn how to:
100100
>
101101
> For example, `CREATE USER [[email protected]] FROM EXTERNAL PROVIDER`.
102102
103-
## Grant roles to the Azure AD login
103+
## Grant server-level roles to Azure AD logins
104104

105-
[Special roles for SQL Database](/sql/relational-databases/security/authentication-access/database-level-roles#special-roles-for--and-azure-synapse) can be assigned to logins in the virtual master database.
105+
You can add logins to the [built-in server-level roles](security-server-roles.md#built-in-server-level-roles), such as the **##MS_DefinitionReader##**, **##MS_ServerStateReader##**, or **##MS_ServerStateManager##** role.
106106

107-
In order to grant one of the special database roles, an Azure AD user with a login must be created in the virtual master database.
107+
> [!NOTE]
108+
> The server-level roles mentioned here are not supported for Azure AD groups.
109+
110+
```sql
111+
ALTER SERVER ROLE ##MS_DefinitionReader## ADD MEMBER [AzureAD_object];
112+
```
113+
114+
```sql
115+
ALTER SERVER ROLE ##MS_ServerStateReader## ADD MEMBER [AzureAD_object];
116+
```
117+
118+
```sql
119+
ALTER SERVER ROLE ##MS_ServerStateManager## ADD MEMBER [AzureAD_object];
120+
```
121+
122+
Permissions aren't effective until the user reconnects. Flush the DBCC cache as well:
123+
124+
```sql
125+
DBCC FLUSHAUTHCACHE
126+
DBCC FREESYSTEMCACHE('TokenAndPermUserStore') WITH NO_INFOMSGS
127+
```
128+
129+
To check which Azure AD logins are part of server-level roles, run the following query:
130+
131+
```sql
132+
SELECT roles.principal_id AS RolePID,roles.name AS RolePName,
133+
server_role_members.member_principal_id AS MemberPID, members.name AS MemberPName
134+
FROM sys.server_role_members AS server_role_members
135+
INNER JOIN sys.server_principals AS roles
136+
ON server_role_members.role_principal_id = roles.principal_id
137+
INNER JOIN sys.server_principals AS members
138+
ON server_role_members.member_principal_id = members.principal_id;
139+
```
140+
141+
## Grant special roles for Azure AD users
142+
143+
[Special roles for SQL Database](/sql/relational-databases/security/authentication-access/database-level-roles#special-roles-for--and-azure-synapse) can be assigned to users in the virtual master database.
144+
145+
In order to grant one of the special database roles to a user, the user must exist in the virtual master database.
108146

109147
To add a user to a role, you can run the following query:
110148

@@ -150,44 +188,6 @@ In our example, we created the user `[email protected]`. Let's give the user the *
150188
loginmanager [email protected]
151189
```
152190

153-
### Server-level roles
154-
155-
You can also choose to give the user additional [built-in server-level roles](security-server-roles.md#built-in-server-level-roles), such as the **##MS_DefinitionReader##**, **##MS_ServerStateReader##**, or **##MS_ServerStateManager##** role.
156-
157-
> [!NOTE]
158-
> The server-level roles mentioned here are not supported for Azure AD groups.
159-
160-
```sql
161-
ALTER SERVER ROLE ##MS_DefinitionReader## ADD MEMBER [AzureAD_object];
162-
```
163-
164-
```sql
165-
ALTER SERVER ROLE ##MS_ServerStateReader## ADD MEMBER [AzureAD_object];
166-
```
167-
168-
```sql
169-
ALTER SERVER ROLE ##MS_ServerStateManager## ADD MEMBER [AzureAD_object];
170-
```
171-
172-
Permissions aren't effective until the user reconnects. Flush the DBCC cache as well:
173-
174-
```sql
175-
DBCC FLUSHAUTHCACHE
176-
DBCC FREESYSTEMCACHE('TokenAndPermUserStore') WITH NO_INFOMSGS
177-
```
178-
179-
To check which Azure AD logins are part of server-level roles, run the following query:
180-
181-
```sql
182-
SELECT roles.principal_id AS RolePID,roles.name AS RolePName,
183-
server_role_members.member_principal_id AS MemberPID, members.name AS MemberPName
184-
FROM sys.server_role_members AS server_role_members
185-
INNER JOIN sys.server_principals AS roles
186-
ON server_role_members.role_principal_id = roles.principal_id
187-
INNER JOIN sys.server_principals AS members
188-
ON server_role_members.member_principal_id = members.principal_id;
189-
```
190-
191191
## Optional - Disable a login
192192

193193
The [ALTER LOGIN (Transact-SQL)](/sql/t-sql/statements/alter-login-transact-sql?view=azuresqldb-current&preserve-view=true) DDL syntax can be used to enable or disable an Azure AD login in Azure SQL Database.

articles/azure-sql/database/authentication-azure-ad-logins.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ ms.date: 03/14/2022
1919
2020
You can now create and utilize Azure AD server principals, which are logins in the virutal master database of a SQL Database. There are several benefits of using Azure AD server principals for SQL Database:
2121

22-
- Support multiple Azure AD login accounts with [special roles for SQL Database](/sql/relational-databases/security/authentication-access/database-level-roles#special-roles-for--and-azure-synapse), such as the `loginmanager` and `dbmanager` roles.
2322
- Support [Azure SQL Database server roles for permission management](security-server-roles.md).
23+
- Support multiple Azure AD users with [special roles for SQL Database](/sql/relational-databases/security/authentication-access/database-level-roles#special-roles-for--and-azure-synapse), such as the `loginmanager` and `dbmanager` roles.
2424
- Functional parity between SQL logins and Azure AD logins.
2525
- Increase functional improvement support, such as utilizing [Azure AD-only authentication](authentication-azure-ad-only-authentication.md). Azure AD-only authentication allows SQL authentication to be disabled, which includes the SQL server admin, SQL logins and users.
2626
- Allows Azure AD principals to support geo-replicas. Azure AD principals will be able to connect to the geo-replica of a user database, with a *read-only* permission and *deny* permission to the primary server.

0 commit comments

Comments
 (0)