You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/postgresql/flexible-server/how-to-manage-azure-ad-users.md
+81-43Lines changed: 81 additions & 43 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ description: This article describes how you can manage Microsoft Entra ID enable
4
4
author: achudnovskij
5
5
ms.author: anchudno
6
6
ms.reviewer: maghan
7
-
ms.date: 04/27/2024
7
+
ms.date: 06/20/2024
8
8
ms.service: postgresql
9
9
ms.subservice: flexible-server
10
10
ms.topic: how-to
@@ -24,8 +24,6 @@ This article describes how you can create a Microsoft Entra ID enabled database
24
24
25
25
If you like to learn about how to create and manage Azure subscription users and their privileges, you can visit the [Azure role-based access control (Azure RBAC) article](../../role-based-access-control/built-in-roles.md) or review [how to customize roles](../../role-based-access-control/custom-roles.md).
## Create or delete Microsoft Entra administrators using Azure portal or Azure Resource Manager (ARM) API
30
28
31
29
1. Open the **Authentication** page for your Azure Database for PostgreSQL flexible server instance in the Azure portal.
@@ -39,8 +37,6 @@ If you like to learn about how to create and manage Azure subscription users and
39
37
> [!NOTE]
40
38
> Support for Microsoft Entra Administrators management via Azure SDK, az cli and Azure PowerShell is coming soon.
41
39
42
-
<aname='manage-azure-ad-roles-using-sql'></a>
43
-
44
40
## Manage Microsoft Entra roles using SQL
45
41
46
42
Once the first Microsoft Entra administrator is created from the Azure portal or API, you can use the administrator role to manage Microsoft Entra roles in your Azure Database for PostgreSQL flexible server instance.
@@ -56,38 +52,54 @@ Each PostgreSQL database role can be mapped to one of the following Microsoft En
56
52
1.**Service Principal**. Including [Applications and Managed identities](../../active-directory/develop/app-objects-and-service-principals.md)
57
53
1.**Group** When a PostgreSQL role is linked to a Microsoft Entra group, any user or service principal member of this group can connect to the Azure Database for PostgreSQL flexible server instance with the group role.
-*roleName* - Name of the role to be created. This **must match a name of Microsoft Entra principal**:
83
+
#### Arguments
84
+
85
+
##### `roleName`
86
+
87
+
`text` name of the role to be created. This **must match the name of the Microsoft Entra principal**.
85
88
- For **users** use User Principal Name from Profile. For guest users, include the full name in their home domain with #EXT# tag.
86
89
- For **groups** and **service principals** use display name. The name must be unique in the tenant.
87
-
-*isAdmin* - Set to **true** if when creating an admin user and **false** for a regular user. Admin user created this way has the same privileges as one created via portal or API.
88
-
-*isMfa* - Flag if Multi Factor Authentication must be enforced for this role.
`boolean` when `true` it creates a PostgreSQL admin user (member of `azure_pg_admin` role and with CREATEROLE and CREATEDB permissions). When `false` it creates a regular PostgreSQL user.
93
+
94
+
##### `isMfa`
95
+
`boolean` when `true` it enforces multifactor authentication for this PostgreSQL user.
96
+
97
+
> [!IMPORTANT]
98
+
> The `isMfa` flag tests the `mfa` claim in the Microsoft Entra ID token, but it doesn't impact the token acquisition flow. For example, if the tenant of the principal is not configured for multifactor authentication, it will prevent the use of the feature. And if the tenant requires multifactor authentication for all tokens, it will make this flag useless.
99
+
100
+
#### Return type
101
+
102
+
`text` single value that consists of a string "Created role for ***roleName***", where ***roleName*** is the argument passed for the **roleName** parameter.
91
103
92
104
## Drop a role using Microsoft Entra principal name
93
105
@@ -100,38 +112,64 @@ DROP ROLE rolename;
100
112
## Create a role using Microsoft Entra object identifier
-*objectId* - Unique object identifier of the Microsoft Entra object:
111
-
- For **Users**, **Groups** and **Managed Identities** the ObjectId can be found by searching for the object name in Microsoft Entra ID page in Azure portal. [See this guide as example](/partner-center/find-ids-and-domain-names)
112
-
- For **Applications**, Objectid of the corresponding **Service Principal** must be used. In Azure portal the required ObjectId can be found on **Enterprise Applications** page.
113
-
-*objectType* - Type of the Microsoft Entra object to link to this role: service, user, group.
114
-
-*isAdmin* - Set to **true** if when creating an admin user and **false** for a regular user. Admin user created this way has the same privileges as one created via portal or API.
115
-
-*isMfa* - Flag if Multi Factor Authentication must be enforced for this role.
`text` unique object identifier of the Microsoft Entra object.
127
+
- For **users**, **groups**, and **managed identities**, the objectId can be found by searching for the object name in [Microsoft Entra ID](https://ms.portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade) page in Azure portal. [See this guide as example](/partner-center/find-ids-and-domain-names)
128
+
- For **groups** and **service principals** use display name. The name must be unique in the tenant.
129
+
- For **applications**, the objectId of the corresponding **Service Principal** must be used. In Azure portal the required objectId can be found on [Enterprise Applications](https://ms.portal.azure.com/#view/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/~/EnterpriseApps) page in Azure portal.
130
+
131
+
##### `objectType`
132
+
`text` the type of Microsoft Entra object to link to this role. It can be `user`, `group`, or `service`.
133
+
134
+
##### `isAdmin`
135
+
`boolean` when `true` it creates a PostgreSQL admin user (member of `azure_pg_admin` role and with CREATEROLE and CREATEDB permissions). When `false` it creates a regular PostgreSQL user.
136
+
137
+
##### `isMfa`
138
+
`boolean` when `true` it enforces multifactor authentication for this PostgreSQL user.
139
+
140
+
> [!IMPORTANT]
141
+
> The `isMfa` flag tests the `mfa` claim in the Microsoft Entra ID token, but it doesn't impact the token acquisition flow. For example, if the tenant of the principal is not configured for multifactor authentication, it will prevent the use of the feature. And if the tenant requires multifactor authentication for all tokens, it will make this flag useless.
142
+
143
+
#### Return type
144
+
145
+
`text` single value that consists of a string "Created role for ***roleName***", where ***roleName*** is the argument passed for the **roleName** parameter.
118
146
119
147
## Enable Microsoft Entra authentication for an existing PostgreSQL role using SQL
120
148
121
-
Azure Database for PostgreSQL flexible server uses security labels associated with database roles to store Microsoft Entra ID mapping.
149
+
Azure Database for PostgreSQL flexible server uses security labels associated with database roles to store their corresponding Microsoft Entra ID mapping.
122
150
123
-
You can use the following SQL to assign security label:
151
+
You can use the following SQL to assign the required security label to map it to a Microsoft Entra object:
124
152
125
153
```sql
126
-
SECURITY LABEL for "pgaadauth"on role "<roleName>" is 'aadauth,oid=<objectId>,type=<user|group|service>,admin';
154
+
SECURITY LABEL for "pgaadauth"on role "<roleName>" is 'aadauth,oid=<objectId>,type=<objectType>,admin';
127
155
```
156
+
#### Arguments
157
+
158
+
##### `roleName`
159
+
160
+
`text` name of an existing PostgreSQL role to which Microsoft Entra authentication needs to be enabled.
161
+
162
+
##### `objectId`
163
+
164
+
`text` unique object identifier of the Microsoft Entra object.
165
+
166
+
##### `objectType`
167
+
168
+
`text` it can be set to `user`, `group`, or `service` (for applications or managed identities connecting under their own service credentials).
169
+
170
+
##### `admin`
128
171
129
-
**Parameters:**
130
-
-*roleName* - Name of an existing PostgreSQL role to which Microsoft Entra authentication needs to be enabled.
131
-
-*objectId* - Unique object identifier of the Microsoft Entra object.
132
-
-*user* - End user principals.
133
-
-*service* - Applications or Managed Identities connecting under their own service credentials.
134
-
-*group* - Name of Microsoft Entra group.
172
+
`text` it can be present or absent. Users/roles for which this part is present in their security label, can manage other Microsoft Entra ID roles.
0 commit comments