Skip to content

Commit 042a322

Browse files
authored
Add extension - single server
1 parent 7844290 commit 042a322

File tree

1 file changed

+35
-29
lines changed

1 file changed

+35
-29
lines changed

articles/spring-apps/how-to-bind-postgres.md

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -49,29 +49,29 @@ Use the following steps to prepare your project.
4949

5050
## Bind your app to the Azure Database for PostgreSQL instance
5151

52-
### [Using admin credentials](#tab/Secrets)
53-
54-
Use the following steps to bind your app.
52+
### [Using a passwordless connection with a managed identity for flexible server](#tab/Passwordlessflex)
5553

56-
1. Note the admin username and password of your Azure Database for PostgreSQL account.
54+
1. Install the [Service Connector](../service-connector/overview.md) passwordless extension for the Azure CLI:
5755

58-
1. Connect to the server, create a database named **testdb** from a PostgreSQL client, and then create a new non-admin account.
56+
```azurecli
57+
az extension add --name serviceconnector-passwordless --upgrade
58+
```
5959

60-
1. Run the following command to connect to the database with admin username and password.
60+
1. Configure Azure Spring Apps to connect to the PostgreSQL Database with a system-assigned managed identity using the `az spring connection create` command.
6161

6262
```azurecli
63-
az spring connection create postgres \
64-
--resource-group $AZURE_SPRING_APPS_RESOURCE_GROUP \
65-
--service $AZURE_SPRING_APPS_SERVICE_INSTANCE_NAME \
63+
az spring connection create postgres-flexible \
64+
--resource-group $SPRING_APPS_RESOURCE_GROUP \
65+
--service $SPRING_APPS_SERVICE_NAME \
6666
--app $APP_NAME \
6767
--deployment $DEPLOYMENT_NAME \
6868
--target-resource-group $POSTGRES_RESOURCE_GROUP \
6969
--server $POSTGRES_SERVER_NAME \
70-
--database testdb \
71-
--secret name=$USERNAME secret=$PASSWORD
70+
--database $DATABASE_NAME \
71+
--system-identity
7272
```
7373

74-
### [Using a passwordless connection with a managed identity for flexible server](#tab/Passwordlessflex)
74+
### [Using a passwordless connection with a managed identity for single server](#tab/Passwordlesssingle)
7575

7676
1. Install the [Service Connector](../service-connector/overview.md) passwordless extension for the Azure CLI:
7777

@@ -82,9 +82,9 @@ Use the following steps to bind your app.
8282
1. Configure Azure Spring Apps to connect to the PostgreSQL Database with a system-assigned managed identity using the `az spring connection create` command.
8383

8484
```azurecli
85-
az spring connection create postgres-flexible \
86-
--resource-group $SPRING_APP_RESOURCE_GROUP \
87-
--service $Spring_APP_SERVICE_NAME \
85+
az spring connection create postgres \
86+
--resource-group $SPRING_APPS_RESOURCE_GROUP \
87+
--service $SPRING_APPQ_SERVICE_NAME \
8888
--app $APP_NAME \
8989
--deployment $DEPLOYMENT_NAME \
9090
--target-resource-group $POSTGRES_RESOURCE_GROUP \
@@ -93,21 +93,27 @@ Use the following steps to bind your app.
9393
--system-identity
9494
```
9595

96-
### [Using a passwordless connection with a managed identity for single server](#tab/Passwordlesssingle)
96+
### [Using admin credentials](#tab/Secrets)
97+
98+
Use the following steps to bind your app.
99+
100+
1. Note the admin username and password of your Azure Database for PostgreSQL account.
101+
102+
1. Connect to the server, create a database named **testdb** from a PostgreSQL client, and then create a new non-admin account.
103+
104+
1. Run the following command to connect to the database with admin username and password.
97105

98-
Configure Azure Spring Apps to connect to the PostgreSQL Database with a system-assigned managed identity using the `az spring connection create` command.
99-
100-
```azurecli
101-
az spring connection create postgres \
102-
--resource-group $SPRING_APP_RESOURCE_GROUP \
103-
--service $Spring_APP_SERVICE_NAME \
104-
--app $APP_NAME \
105-
--deployment $DEPLOYMENT_NAME \
106-
--target-resource-group $POSTGRES_RESOURCE_GROUP \
107-
--server $POSTGRES_SERVER_NAME \
108-
--database $DATABASE_NAME \
109-
--system-identity
110-
```
106+
```azurecli
107+
az spring connection create postgres \
108+
--resource-group $AZURE_SPRING_APPS_RESOURCE_GROUP \
109+
--service $AZURE_SPRING_APPS_SERVICE_INSTANCE_NAME \
110+
--app $APP_NAME \
111+
--deployment $DEPLOYMENT_NAME \
112+
--target-resource-group $POSTGRES_RESOURCE_GROUP \
113+
--server $POSTGRES_SERVER_NAME \
114+
--database testdb \
115+
--secret name=$USERNAME secret=$PASSWORD
116+
```
111117

112118
---
113119

0 commit comments

Comments
 (0)