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/service-connector/includes/code-postgres-me-id.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -100,6 +100,7 @@ For more tutorials, see [Use Spring Data JDBC with Azure Database for PostgreSQL
100
100
```bash
101
101
pip install azure-identity
102
102
pip install psycopg2-binary
103
+
pip freeze > requirements.txt # Save the dependencies to a file
103
104
```
104
105
1. Get access token using `azure-identity` library and use the token as password. Get connection information from the environment variables added by Service Connector. When using the code below, uncomment the part of the code snippet for the authentication type you want to use.
Copy file name to clipboardExpand all lines: articles/service-connector/includes/install-passwordless-extension.md
+4-1Lines changed: 4 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,8 +6,11 @@ ms.date: 05/21/2023
6
6
ms.author: xiaofanzhou
7
7
---
8
8
9
-
Install the Service Connector passwordless extension for the Azure CLI:
9
+
Install the latest Service Connector passwordless extension for the Azure CLI:
10
10
11
11
```azurecli-interactive
12
12
az extension add --name serviceconnector-passwordless --upgrade
13
13
```
14
+
15
+
> [!NOTE]
16
+
> Please check the extension "serviceconnector-passwordless" version is "2.0.2" or higher by running `az version`. You may need to upgrade Azure CLI first to upgrade the extension version.
Copy file name to clipboardExpand all lines: articles/service-connector/includes/passwordless-tutorial-snippet.md
+31-4Lines changed: 31 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,7 @@ If you use:
25
25
26
26
::: zone pivot="postgresql"
27
27
28
-
The following Azure CLI command uses a `--client-type` parameter. Run the `az webapp connection create postgres-flexible -h` to get the supported client types, and choose the one that matches your application.
28
+
The following Azure CLI command uses a `--client-type` parameter, it can be java, dotnet, python, etc. Run the `az webapp connection create postgres-flexible -h` to get the supported client types, and choose the one that matches your application.
29
29
30
30
### [User-assigned managed identity](#tab/user)
31
31
@@ -37,7 +37,7 @@ az webapp connection create postgres-flexible \
@@ -50,7 +50,7 @@ az webapp connection create postgres-flexible \
50
50
--server $POSTGRESQL_HOST \
51
51
--database $DATABASE_NAME \
52
52
--system-identity \
53
-
--client-type java
53
+
--client-type $CLIENT_TYPE
54
54
```
55
55
56
56
### [Service principal](#tab/sp)
@@ -63,7 +63,7 @@ az webapp connection create postgres-flexible \
63
63
--server $POSTGRESQL_HOST \
64
64
--database $DATABASE_NAME \
65
65
--service-principal client-id=XX secret=XX\
66
-
--client-type java
66
+
--client-type $CLIENT_TYPE
67
67
```
68
68
69
69
::: zone-end
@@ -185,12 +185,39 @@ az webapp connection create sql \
185
185
This Service Connector command completes the following tasks in the background:
186
186
187
187
* Enable system-assigned managed identity, or assign a user identity for the app `$APPSERVICE_NAME` hosted by Azure App Service/Azure Spring Apps/Azure Container Apps.
188
+
* Enable Microsoft Entra Authentication for the database server if it's not enabled before.
188
189
* Set the Microsoft Entra admin to the current signed-in user.
189
190
* Add a database user for the system-assigned managed identity, user-assigned managed identity, or service principal. Grant all privileges of the database `$DATABASE_NAME` to this user. The username can be found in the connection string in preceding command output.
190
191
* Set configurations named `AZURE_MYSQL_CONNECTIONSTRING`, `AZURE_POSTGRESQL_CONNECTIONSTRING`, or `AZURE_SQL_CONNECTIONSTRING` to the Azure resource based on the database type.
191
192
* For App Service, the configurations are set in the **App Settings** blade.
192
193
* For Spring Apps, the configurations are set when the application is launched.
193
194
* For Container Apps, the configurations are set to the environment variables. You can get all configurations and their values in the **Service Connector** blade in the Azure portal.
195
+
196
+
197
+
Service Connector will assign the following privileges to the user, you can revoke them and adjust the privileges based on your requirements.
198
+
199
+
::: zone pivot="postgresql"
200
+
```
201
+
GRANT ALL PRIVILEGES ON DATABASE "$DATABASE_NAME" TO "username";
202
+
203
+
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO "username";
204
+
205
+
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO "username";
206
+
```
207
+
::: zone-end
208
+
209
+
::: zone pivot="mysql"
210
+
```
211
+
212
+
GRANT ALL PRIVILEGES ON $DATABASE_NAME.* TO 'username'@'%';
213
+
```
214
+
::: zone-end
215
+
216
+
::: zone pivot="sql"
217
+
```
218
+
GRANT CONTROL ON DATABASE::"$DATABASE_NAME" TO "username";
219
+
```
220
+
::: zone-end
194
221
195
222
## Connect to a database with Microsoft Entra authentication
Copy file name to clipboardExpand all lines: articles/service-connector/tutorial-passwordless.md
+5-4Lines changed: 5 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,7 @@ In this tutorial, you use the Azure CLI to complete the following tasks:
28
28
29
29
## Prerequisites
30
30
31
-
*[Azure CLI](/cli/azure/install-azure-cli) version 2.48.1 or higher.
31
+
*[Azure CLI](/cli/azure/install-azure-cli) version 2.61.0 or higher.
32
32
* An Azure account with an active subscription. [Create an Azure account for free](https://azure.microsoft.com/free).
33
33
* An app deployed to [Azure App Service](../app-service/overview.md) in a [region supported by Service Connector](./concept-region-support.md).
34
34
@@ -47,15 +47,16 @@ Finally, deploy your application to an Azure hosting service. That source servic
47
47
48
48
### [App Service](#tab/appservice)
49
49
50
-
For Azure App Service, you can deploy the application code via the `az webapp deploy` command. For more information, see [Quickstart: Deploy an ASP.NET web app](../app-service/quickstart-dotnetcore.md).
50
+
For Azure App Service, you can check the document to choose a way to deploy, see [Quickstart: Deploy an ASP.NET web app](../app-service/quickstart-dotnetcore.md).
51
51
52
52
### [Spring Apps](#tab/springapp)
53
53
54
-
For Azure Spring Apps, you can deploy the application code via the `az spring app deploy` command. For more information, see [Quickstart: Deploy your first application to Azure Spring Apps](../spring-apps/enterprise/quickstart.md).
54
+
For Azure Spring Apps, you can check the document for more details about building app and deployment, see [Build and deploy the app](/azure/developer/java/spring-framework/deploy-passwordless-spring-database-app?#build-and-deploy-the-app).
55
+
55
56
56
57
### [Container Apps](#tab/containerapp)
57
58
58
-
For Azure Container Apps, you can deploy the application code via the `az containerapp create` command. For more information, see [Quickstart: Deploy your first container app](../container-apps/get-started.md).
59
+
For Azure Container Apps, you can check the document about how to deploy your app, see [Quickstart: Deploy your first container app](../container-apps/get-started.md).
0 commit comments