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
With Azure Spring Apps, you can bind select Azure services to your applications automatically, instead of having to configure your Spring Boot application manually. This article shows you how to bind your application to your Azure Database for PostgreSQL instance.
22
22
23
+
::: zone pivot="mysql-passwordless-flexible-server"
24
+
23
25
## Prerequisites
24
26
25
27
* An application deployed to Azure Spring Apps. For more information, see [Quickstart: Deploy your first application to Azure Spring Apps](./quickstart.md).
@@ -49,7 +51,7 @@ Use the following steps to prepare your project.
49
51
50
52
## Bind your app to the Azure Database for PostgreSQL instance
51
53
52
-
### [Service Connector for flexible server](#tab/Passwordlessflex)
54
+
### [Passwordless](#tab/Passwordlessflex)
53
55
54
56
1. Install the [Service Connector](../service-connector/overview.md) passwordless extension for the Azure CLI:
55
57
@@ -71,7 +73,64 @@ Use the following steps to prepare your project.
71
73
--system-identity
72
74
```
73
75
74
-
### [Service Connector for single server](#tab/Passwordlesssingle)
76
+
### [Password](#tab/Secretsflex)
77
+
78
+
Use the following steps to bind your app using a secret.
79
+
80
+
1. Note the admin username and password of your Azure Database for PostgreSQL account.
81
+
82
+
1. Connect to the server, create a database named **testdb** from a PostgreSQL client, and then create a new non-admin account.
83
+
84
+
1. Run the following command to connect to the database with admin username and password.
* An application deployed to Azure Spring Apps. For more information, see [Quickstart: Deploy your first application to Azure Spring Apps](./quickstart.md).
107
+
* An Azure Database for PostgreSQL Single Server instance.
108
+
*[Azure CLI](/cli/azure/install-azure-cli) version 2.45.0 or higher.
109
+
110
+
## Prepare your Java project
111
+
112
+
Use the following steps to prepare your project.
113
+
114
+
1. In your project's *pom.xml* file, add the following dependency:
1. In the *application.properties* file, remove any `spring.datasource.*` properties.
128
+
129
+
1. Update the current app by running `az spring app deploy`, or create a new deployment for this change by running `az spring app deployment create`.
130
+
131
+
## Bind your app to the Azure Database for PostgreSQL instance
132
+
133
+
### [Passwordless](#tab/PasswordlessSingle)
75
134
76
135
1. Install the [Service Connector](../service-connector/overview.md) passwordless extension for the Azure CLI:
77
136
@@ -93,7 +152,7 @@ Use the following steps to prepare your project.
93
152
--system-identity
94
153
```
95
154
96
-
### [Service Connector with password](#tab/Secrets)
155
+
### [Password](#tab/SecretsSingle)
97
156
98
157
Use the following steps to bind your app using a secret.
99
158
@@ -117,6 +176,8 @@ Use the following steps to bind your app using a secret.
117
176
118
177
---
119
178
179
+
::: zone-end
180
+
120
181
## Next steps
121
182
122
183
In this article, you learned how to bind an application in Azure Spring Apps to an Azure Database for PostgreSQL instance. To learn more about binding services to an application, see [Bind an Azure Cosmos DB database to an application in Azure Spring Apps](./how-to-bind-cosmos.md).
0 commit comments