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
cd Passwordless-Connections-for-Java-Apps/Tomcat/checklist/
36
+
cd Passwordless-Connections-for-Java-Apps/Tomcat/
37
37
```
38
38
39
39
## Create an Azure Postgres DB
40
40
41
-
Follow these steps to create an Azure Database for Postgres Single Server in your subscription. The Spring Boot app will connect to this database and store its data when running, persisting the application state no matter where you run the application.
41
+
Follow these steps to create an Azure Database for Postgres in your subscription. The Spring Boot app will connect to this database and store its data when running, persisting the application state no matter where you run the application.
42
42
43
43
1. Sign into the Azure CLI, and optionally set your subscription if you have more than one connected to your login credentials.
44
44
@@ -56,11 +56,32 @@ Follow these steps to create an Azure Database for Postgres Single Server in you
56
56
az group create --name $RESOURCE_GROUP --location $LOCATION
57
57
```
58
58
59
-
1. Create an Azure Postgres Database server. The server is created with an administrator account, but it won't be used as we'll use the Azure Active Directory (Azure AD) admin account to perform administrative tasks.
59
+
1. Create an Azure Postgres Database server. The server is created with an administrator account, but it won't be used because we'll use the Azure Active Directory (Azure AD) admin account to perform administrative tasks.
60
+
61
+
### [Flexible Server](#tab/flexible)
62
+
63
+
```azurecli-interactive
64
+
POSTGRESQL_ADMIN_USER=azureuser
65
+
# PostgreSQL admin access rights won't be used because Azure AD authentication is leveraged to administer the database.
66
+
POSTGRESQL_ADMIN_PASSWORD=<admin-password>
67
+
POSTGRESQL_HOST=<postgresql-host-name>
68
+
69
+
# Create a PostgreSQL server.
70
+
az postgres flexible-server create \
71
+
--resource-group $RESOURCE_GROUP \
72
+
--name $POSTGRESQL_HOST \
73
+
--location $LOCATION \
74
+
--admin-user $POSTGRESQL_ADMIN_USER \
75
+
--admin-password $POSTGRESQL_ADMIN_PASSWORD \
76
+
--public-network-access 0.0.0.0 \
77
+
--sku-name Standard_D2s_v3
78
+
```
79
+
80
+
### [Single Server](#tab/single)
60
81
61
82
```azurecli-interactive
62
83
POSTGRESQL_ADMIN_USER=azureuser
63
-
# PostgreSQL admin access rights won't be used as Azure AD authentication is leveraged to administer the database.
84
+
# PostgreSQL admin access rights won't be used because Azure AD authentication is leveraged to administer the database.
64
85
POSTGRESQL_ADMIN_PASSWORD=<admin-password>
65
86
POSTGRESQL_HOST=<postgresql-host-name>
66
87
@@ -77,6 +98,19 @@ Follow these steps to create an Azure Database for Postgres Single Server in you
77
98
78
99
1. Create a database for the application.
79
100
101
+
### [Flexible Server](#tab/flexible)
102
+
103
+
```azurecli-interactive
104
+
DATABASE_NAME=checklist
105
+
106
+
az postgres flexible-server db create \
107
+
--resource-group $RESOURCE_GROUP \
108
+
--server-name $POSTGRESQL_HOST \
109
+
--database-name $DATABASE_NAME
110
+
```
111
+
112
+
### [Single Server](#tab/single)
113
+
80
114
```azurecli-interactive
81
115
DATABASE_NAME=checklist
82
116
@@ -90,17 +124,17 @@ Follow these steps to create an Azure Database for Postgres Single Server in you
90
124
91
125
Follow these steps to build a WAR file and deploy to Azure App Service on Tomcat using a WAR packaging.
92
126
93
-
The changes you made in *application.properties* also apply to the managed identity, so the only thing to do is to remove the existing application settings in App Service.
94
-
95
-
1. The sample app contains a *pom-war.xml* file that can generate the WAR file. Run the following command to build the app.
127
+
1. The sample app contains a *pom.xml* file that can generate the WAR file. Run the following command to build the app.
96
128
97
129
```bash
98
-
mvn clean package -f pom-war.xml
130
+
mvn clean package -f pom.xml
99
131
```
100
132
101
133
1. Create an Azure App Service resource on Linux using Tomcat 9.0.
102
134
103
135
```azurecli-interactive
136
+
APPSERVICE_PLAN=<app-service-plan>
137
+
APPSERVICE_NAME=<app-service-name>
104
138
# Create an App Service plan
105
139
az appservice plan create \
106
140
--resource-group $RESOURCE_GROUP \
@@ -129,7 +163,25 @@ The changes you made in *application.properties* also apply to the managed ident
129
163
130
164
## Connect Postgres Database with identity connectivity
131
165
132
-
Next, connect your app to an Postgres Database Single Server with a system-assigned managed identity using Service Connector. To do this, run the [az webapp connection create](/cli/azure/webapp/connection/create#az-webapp-connection-create-postgres) command.
166
+
Next, connect your app to a Postgres Database with a system-assigned managed identity using Service Connector.
167
+
168
+
### [Flexible Server](#tab/flexible)
169
+
170
+
To do this, run the [az webapp connection create](/cli/azure/webapp/connection/create#az-webapp-connection-create-postgres-flexible) command.
171
+
172
+
```azurecli-interactive
173
+
az webapp connection create postgres-flexible \
174
+
--resource-group $RESOURCE_GROUP \
175
+
--name $APPSERVICE_NAME \
176
+
--target-resource-group $RESOURCE_GROUP \
177
+
--server $POSTGRESQL_HOST \
178
+
--database $DATABASE_NAME \
179
+
--system-identity
180
+
```
181
+
182
+
### [Single Server](#tab/single)
183
+
184
+
To do this, run the [az webapp connection create](/cli/azure/webapp/connection/create#az-webapp-connection-create-postgres) command.
133
185
134
186
```azurecli-interactive
135
187
az webapp connection create postgres \
@@ -141,6 +193,7 @@ az webapp connection create postgres \
141
193
--system-identity
142
194
```
143
195
196
+
---
144
197
This command creates a connection between your web app and your PostgreSQL server, and manages authentication through a system-assigned managed identity.
Copy file name to clipboardExpand all lines: articles/container-apps/tutorial-java-quarkus-connect-managed-identity-postgresql-database.md
+117-9Lines changed: 117 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,12 +45,12 @@ The following example creates a resource group named `myResourceGroup` in the Ea
45
45
az group create --name myResourceGroup --location eastus
46
46
```
47
47
48
-
Create an Azure container registry instance using the [az acr create](/cli/azure/acr#az-acr-create) command. The registry name must be unique within Azure, and contain 5-50 alphanumeric characters. In the following example, `myContainerRegistry007` is used. Update this to a unique value.
48
+
Create an Azure container registry instance using the [az acr create](/cli/azure/acr#az-acr-create) command. The registry name must be unique within Azure, contain 5-50 alphanumeric characters. All letters must be specified in lower case. In the following example, `mycontainerregistry007` is used. Update this to a unique value.
49
49
50
50
```azurecli
51
51
az acr create \
52
52
--resource-group myResourceGroup \
53
-
--name myContainerRegistry007 \
53
+
--name mycontainerregistry007 \
54
54
--sku Basic
55
55
```
56
56
@@ -83,6 +83,69 @@ cd quarkus-quickstarts/hibernate-orm-panache-quickstart
83
83
84
84
Delete the existing content in *application.properties* and replace with the following to configure the database for dev, test, and production modes:
@@ -146,11 +209,11 @@ cd quarkus-quickstarts/hibernate-orm-panache-quickstart
146
209
147
210
1. Build the container image.
148
211
149
-
Run the following command to build the Quarkus app image. You must tag it with the fully qualified name of your registry login server. The login server name is in the format *\<registry-name\>.azurecr.io* (must be all lowercase), for example, *myContainerRegistry007.azurecr.io*. Replace the name with your own registry name.
212
+
Run the following command to build the Quarkus app image. You must tag it with the fully qualified name of your registry login server. The login server name is in the format *\<registry-name\>.azurecr.io* (must be all lowercase), for example, *mycontainerregistry007.azurecr.io*. Replace the name with your own registry name.
@@ -165,10 +228,10 @@ cd quarkus-quickstarts/hibernate-orm-panache-quickstart
165
228
166
229
1. Push the image to the registry.
167
230
168
-
Use [docker push][docker-push] to push the image to the registry instance. Replace `myContainerRegistry007` with the login server name of your registry instance. This example creates the `quarkus-postgres-passwordless-app` repository, containing the `quarkus-postgres-passwordless-app:v1` image.
231
+
Use [docker push][docker-push] to push the image to the registry instance. Replace `mycontainerregistry007` with the login server name of your registry instance. This example creates the `quarkus-postgres-passwordless-app` repository, containing the `quarkus-postgres-passwordless-app:v1` image.
@@ -206,10 +269,28 @@ cd quarkus-quickstarts/hibernate-orm-panache-quickstart
206
269
207
270
## 5. Create and connect a PostgreSQL database with identity connectivity
208
271
209
-
Next, create a PostgreSQL Database Single Server and configure your container app to connect to a PostgreSQL Database with a system-assigned managed identity. The Quarkus app will connect to this database and store its data when running, persisting the application state no matter where you run the application.
272
+
Next, create a PostgreSQL Database and configure your container app to connect to a PostgreSQL Database with a system-assigned managed identity. The Quarkus app will connect to this database and store its data when running, persisting the application state no matter where you run the application.
Copy file name to clipboardExpand all lines: articles/spring-apps/how-to-bind-postgres.md
+21-4Lines changed: 21 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -70,19 +70,36 @@ Use the following steps to bind your app.
70
70
--secret name=$USERNAME secret=$PASSWORD
71
71
```
72
72
73
-
### [Using a passwordless connection with a managed identity](#tab/Passwordless)
73
+
### [Using a passwordless connection with a managed identity for flexible server](#tab/Passwordlessflex)
74
74
75
-
Configure Azure Spring Apps to connect to the PostgreSQL Database Single Server with a system-assigned managed identity using the `az spring connection create` command.
75
+
Configure Azure Spring Apps to connect to the PostgreSQL Database with a system-assigned managed identity using the `az spring connection create` command.
### [Using a passwordless connection with a managed identity for single server](#tab/Passwordlesssingle)
90
+
91
+
Configure Azure Spring Apps to connect to the PostgreSQL Database with a system-assigned managed identity using the `az spring connection create` command.
0 commit comments