Skip to content

Commit 866f256

Browse files
Merge pull request #275837 from xfz11/svc/passwordless
{Service Connector} update passwordless doc
2 parents 701770b + 38cd41b commit 866f256

File tree

4 files changed

+41
-9
lines changed

4 files changed

+41
-9
lines changed

articles/service-connector/includes/code-postgres-me-id.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ For more tutorials, see [Use Spring Data JDBC with Azure Database for PostgreSQL
100100
```bash
101101
pip install azure-identity
102102
pip install psycopg2-binary
103+
pip freeze > requirements.txt # Save the dependencies to a file
103104
```
104105
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.
105106

articles/service-connector/includes/install-passwordless-extension.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@ ms.date: 05/21/2023
66
ms.author: xiaofanzhou
77
---
88

9-
Install the Service Connector passwordless extension for the Azure CLI:
9+
Install the latest Service Connector passwordless extension for the Azure CLI:
1010

1111
```azurecli-interactive
1212
az extension add --name serviceconnector-passwordless --upgrade
1313
```
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.

articles/service-connector/includes/passwordless-tutorial-snippet.md

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ If you use:
2525
2626
::: zone pivot="postgresql"
2727

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.
2929

3030
### [User-assigned managed identity](#tab/user)
3131

@@ -37,7 +37,7 @@ az webapp connection create postgres-flexible \
3737
--server $POSTGRESQL_HOST \
3838
--database $DATABASE_NAME \
3939
--user-identity client-id=XX subs-id=XX \
40-
--client-type java
40+
--client-type $CLIENT_TYPE
4141
```
4242

4343
### [System-assigned managed identity](#tab/system)
@@ -50,7 +50,7 @@ az webapp connection create postgres-flexible \
5050
--server $POSTGRESQL_HOST \
5151
--database $DATABASE_NAME \
5252
--system-identity \
53-
--client-type java
53+
--client-type $CLIENT_TYPE
5454
```
5555

5656
### [Service principal](#tab/sp)
@@ -63,7 +63,7 @@ az webapp connection create postgres-flexible \
6363
--server $POSTGRESQL_HOST \
6464
--database $DATABASE_NAME \
6565
--service-principal client-id=XX secret=XX\
66-
--client-type java
66+
--client-type $CLIENT_TYPE
6767
```
6868

6969
::: zone-end
@@ -185,12 +185,39 @@ az webapp connection create sql \
185185
This Service Connector command completes the following tasks in the background:
186186

187187
* 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.
188189
* Set the Microsoft Entra admin to the current signed-in user.
189190
* 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.
190191
* Set configurations named `AZURE_MYSQL_CONNECTIONSTRING`, `AZURE_POSTGRESQL_CONNECTIONSTRING`, or `AZURE_SQL_CONNECTIONSTRING` to the Azure resource based on the database type.
191192
* For App Service, the configurations are set in the **App Settings** blade.
192193
* For Spring Apps, the configurations are set when the application is launched.
193194
* 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
194221

195222
## Connect to a database with Microsoft Entra authentication
196223

articles/service-connector/tutorial-passwordless.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ In this tutorial, you use the Azure CLI to complete the following tasks:
2828
2929
## Prerequisites
3030

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.
3232
* An Azure account with an active subscription. [Create an Azure account for free](https://azure.microsoft.com/free).
3333
* An app deployed to [Azure App Service](../app-service/overview.md) in a [region supported by Service Connector](./concept-region-support.md).
3434

@@ -47,15 +47,16 @@ Finally, deploy your application to an Azure hosting service. That source servic
4747

4848
### [App Service](#tab/appservice)
4949

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).
5151

5252
### [Spring Apps](#tab/springapp)
5353

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+
5556

5657
### [Container Apps](#tab/containerapp)
5758

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).
5960

6061
---
6162

0 commit comments

Comments
 (0)