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/howto-configure-sign-in-aad-authentication.md
+33-31Lines changed: 33 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,9 @@ This article will walk you through the steps how to configure Azure Active Direc
19
19
20
20
## Setting the Azure AD Admin user
21
21
22
-
Only an Azure AD Admin user can create/enable users for Azure AD-based authentication. To create and Azure AD Admin user, please follow the following steps
22
+
Only Azure AD administrator users can create/enable users for Azure AD-based authentication. We recommend not using the Azure AD administrator for regular database operations, as it has elevated user permissions (e.g. CREATEDB).
23
+
24
+
To set the Azure AD administrator (you can use a user or a group), please follow the following steps
23
25
24
26
1. In the Azure portal, select the instance of Azure Database for PostgreSQL that you want to enable for Azure AD.
25
27
2. Under Settings, select Active Directory Admin:
@@ -33,36 +35,6 @@ Only an Azure AD Admin user can create/enable users for Azure AD-based authentic
33
35
34
36
Only one Azure AD admin can be created per PostgreSQL server and selection of another one will overwrite the existing Azure AD admin configured for the server. You can specify an Azure AD group instead of an individual user to have multiple administrators. Note that you will then sign in with the group name for administration purposes.
35
37
36
-
## Creating Azure AD users in Azure Database for PostgreSQL
37
-
38
-
To add an Azure AD user to your Azure Database for PostgreSQL database, perform the following steps after connecting (see later section on how to connect):
39
-
40
-
1. First ensure that the Azure AD user `<user>@yourtenant.onmicrosoft.com` is a valid user in Azure AD tenant.
41
-
2. Sign in to your Azure Database for PostgreSQL instance as the Azure AD Admin user.
42
-
3. Create role `<user>@yourtenant.onmicrosoft.com` in Azure Database for PostgreSQL.
43
-
4. Make `<user>@yourtenant.onmicrosoft.com` a member of role azure_ad_user. This must only be given to Azure AD users.
> Authenticating a user through Azure AD does not give the user any permissions to access objects within the Azure Database for PostgreSQL database. You must grant the user the required permissions manually.
53
-
54
-
## Creating Azure AD groups in Azure Database for PostgreSQL
55
-
56
-
To enable an Azure AD group for access to your database, use the same mechanism as for users, but instead specify the group name:
57
-
58
-
**Example:**
59
-
60
-
```sql
61
-
CREATE ROLE "Prod DB Readonly" WITH LOGIN IN ROLE azure_ad_user;
62
-
```
63
-
64
-
When logging in, members of the group will use their personal access tokens, but sign with the group name specified as the username.
65
-
66
38
## Connecting to Azure Database for PostgreSQL using Azure AD
67
39
68
40
The following high-level diagram summarizes the workflow of using Azure AD authentication with Azure Database for PostgreSQL:
You are now authenticated to your PostgreSQL server using Azure AD authentication.
165
137
138
+
## Creating Azure AD users in Azure Database for PostgreSQL
139
+
140
+
To add an Azure AD user to your Azure Database for PostgreSQL database, perform the following steps after connecting (see later section on how to connect):
141
+
142
+
1. First ensure that the Azure AD user `<user>@yourtenant.onmicrosoft.com` is a valid user in Azure AD tenant.
143
+
2. Sign in to your Azure Database for PostgreSQL instance as the Azure AD Admin user.
144
+
3. Create role `<user>@yourtenant.onmicrosoft.com` in Azure Database for PostgreSQL.
145
+
4. Make `<user>@yourtenant.onmicrosoft.com` a member of role azure_ad_user. This must only be given to Azure AD users.
> Authenticating a user through Azure AD does not give the user any permissions to access objects within the Azure Database for PostgreSQL database. You must grant the user the required permissions manually.
155
+
156
+
## Creating Azure AD groups in Azure Database for PostgreSQL
157
+
158
+
To enable an Azure AD group for access to your database, use the same mechanism as for users, but instead specify the group name:
159
+
160
+
**Example:**
161
+
162
+
```sql
163
+
CREATE ROLE "Prod DB Readonly" WITH LOGIN IN ROLE azure_ad_user;
164
+
```
165
+
166
+
When logging in, members of the group will use their personal access tokens, but sign with the group name specified as the username.
167
+
166
168
## Token Validation
167
169
168
170
Azure AD authentication in Azure Database for PostgreSQL ensures that the user exists in the PostgreSQL server, and it checks the validity of the token by validating the contents of the token. The following token validation steps are performed:
0 commit comments