Skip to content

Commit 01e5a86

Browse files
committed
removed single-server pivots/tabs
1 parent 68563a2 commit 01e5a86

File tree

4 files changed

+3
-273
lines changed

4 files changed

+3
-273
lines changed

articles/app-service/tutorial-java-tomcat-connect-managed-identity-postgresql-database.md

Lines changed: 1 addition & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: 'Tutorial: Access data with managed identity in Java'
33
description: Secure Azure Database for PostgreSQL connectivity with managed identity from a sample Java Tomcat app, and apply it to other Azure services.
44
ms.devlang: java
55
ms.topic: tutorial
6-
ms.date: 10/11/2023
6+
ms.date: 06/04/2024
77
author: KarlErickson
88
ms.author: karler
99
ms.custom: passwordless-java, service-connector, devx-track-azurecli, devx-track-extended-java, AppServiceConnectivity
@@ -59,8 +59,6 @@ Follow these steps to create an Azure Database for Postgres in your subscription
5959

6060
1. Create an Azure Database for PostgreSQL server. The server is created with an administrator account, but it isn't used because we're going to use the Microsoft Entra admin account to perform administrative tasks.
6161

62-
### [Flexible Server](#tab/flexible)
63-
6462
```azurecli-interactive
6563
export POSTGRESQL_ADMIN_USER=azureuser
6664
# PostgreSQL admin access rights won't be used because Azure AD authentication is leveraged to administer the database.
@@ -78,29 +76,8 @@ Follow these steps to create an Azure Database for Postgres in your subscription
7876
--sku-name Standard_D2s_v3
7977
```
8078

81-
### [Single Server](#tab/single)
82-
83-
```azurecli-interactive
84-
export POSTGRESQL_ADMIN_USER=azureuser
85-
# PostgreSQL admin access rights won't be used because Azure AD authentication is leveraged to administer the database.
86-
export POSTGRESQL_ADMIN_PASSWORD=<admin-password>
87-
export POSTGRESQL_HOST=<postgresql-host-name>
88-
89-
# Create a PostgreSQL server.
90-
az postgres server create \
91-
--resource-group $RESOURCE_GROUP \
92-
--name $POSTGRESQL_HOST \
93-
--location $LOCATION \
94-
--admin-user $POSTGRESQL_ADMIN_USER \
95-
--admin-password $POSTGRESQL_ADMIN_PASSWORD \
96-
--public-access 0.0.0.0 \
97-
--sku-name B_Gen5_1
98-
```
99-
10079
1. Create a database for the application.
10180

102-
### [Flexible Server](#tab/flexible)
103-
10481
```azurecli-interactive
10582
export DATABASE_NAME=checklist
10683

@@ -110,17 +87,6 @@ Follow these steps to create an Azure Database for Postgres in your subscription
11087
--database-name $DATABASE_NAME
11188
```
11289

113-
### [Single Server](#tab/single)
114-
115-
```azurecli-interactive
116-
export DATABASE_NAME=checklist
117-
118-
az postgres db create \
119-
--resource-group $RESOURCE_GROUP \
120-
--server-name $POSTGRESQL_HOST \
121-
--name $DATABASE_NAME
122-
```
123-
12490
## Deploy the application to App Service
12591

12692
Follow these steps to build a WAR file and deploy to Azure App Service on Tomcat using a WAR packaging.
@@ -174,8 +140,6 @@ az extension add --name serviceconnector-passwordless --upgrade
174140

175141
Then, connect your app to a Postgres database with a system-assigned managed identity using Service Connector.
176142

177-
### [Flexible Server](#tab/flexible)
178-
179143
To make this connection, run the [az webapp connection create](/cli/azure/webapp/connection/create#az-webapp-connection-create-postgres-flexible) command.
180144

181145
```azurecli-interactive
@@ -189,23 +153,6 @@ az webapp connection create postgres-flexible \
189153
--client-type java
190154
```
191155

192-
### [Single Server](#tab/single)
193-
194-
To make this connection, run the [az webapp connection create](/cli/azure/webapp/connection/create#az-webapp-connection-create-postgres) command.
195-
196-
```azurecli-interactive
197-
az webapp connection create postgres \
198-
--resource-group $RESOURCE_GROUP \
199-
--name $APPSERVICE_NAME \
200-
--target-resource-group $RESOURCE_GROUP \
201-
--server $POSTGRESQL_HOST \
202-
--database $DATABASE_NAME \
203-
--system-identity \
204-
--client-type java
205-
```
206-
207-
---
208-
209156
This command creates a connection between your web app and your PostgreSQL server, and manages authentication through a system-assigned managed identity.
210157

211158
Next, update App Settings and add plugin in connection string

articles/container-apps/tutorial-java-quarkus-connect-managed-identity-postgresql-database.md

Lines changed: 1 addition & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ author: KarlErickson
66
ms.topic: tutorial
77
ms.author: karler
88
ms.service: container-apps
9-
ms.date: 09/26/2022
9+
ms.date: 06/04/2024
1010
ms.custom: devx-track-azurecli, devx-track-extended-java, devx-track-java, devx-track-javaee, devx-track-javaee-quarkus, passwordless-java, service-connector, devx-track-javaee-quarkus-aca
1111
---
1212

@@ -84,8 +84,6 @@ cd quarkus-quickstarts/hibernate-orm-panache-quickstart
8484

8585
Delete the existing content in *application.properties* and replace with the following to configure the database for dev, test, and production modes:
8686

87-
### [Flexible Server](#tab/flexible)
88-
8987
```properties
9088
quarkus.package.type=uber-jar
9189

@@ -145,67 +143,6 @@ cd quarkus-quickstarts/hibernate-orm-panache-quickstart
145143
io.netty:netty-transport-native-unix-common::jar
146144
```
147145

148-
### [Single Server](#tab/single)
149-
150-
```properties
151-
quarkus.package.type=uber-jar
152-
153-
quarkus.hibernate-orm.database.generation=drop-and-create
154-
quarkus.datasource.db-kind=postgresql
155-
quarkus.datasource.jdbc.max-size=8
156-
quarkus.datasource.jdbc.min-size=2
157-
quarkus.hibernate-orm.log.sql=true
158-
quarkus.hibernate-orm.sql-load-script=import.sql
159-
quarkus.datasource.jdbc.acquisition-timeout = 10
160-
161-
%dev.quarkus.datasource.username=${AZURE_CLIENT_NAME}@${DBHOST}
162-
%dev.quarkus.datasource.jdbc.url=jdbc:postgresql://${DBHOST}.postgres.database.azure.com:5432/${DBNAME}?\
163-
authenticationPluginClassName=com.azure.identity.providers.postgresql.AzureIdentityPostgresqlAuthenticationPlugin\
164-
&sslmode=require\
165-
&azure.clientId=${AZURE_CLIENT_ID}\
166-
&azure.clientSecret=${AZURE_CLIENT_SECRET}\
167-
&azure.tenantId=${AZURE_TENANT_ID}
168-
169-
%prod.quarkus.datasource.username=${AZURE_MI_NAME}@${DBHOST}
170-
%prod.quarkus.datasource.jdbc.url=jdbc:postgresql://${DBHOST}.postgres.database.azure.com:5432/${DBNAME}?\
171-
authenticationPluginClassName=com.azure.identity.providers.postgresql.AzureIdentityPostgresqlAuthenticationPlugin\
172-
&sslmode=require
173-
174-
%dev.quarkus.class-loading.parent-first-artifacts=com.azure:azure-core::jar,\
175-
com.azure:azure-core-http-netty::jar,\
176-
io.projectreactor.netty:reactor-netty-core::jar,\
177-
io.projectreactor.netty:reactor-netty-http::jar,\
178-
io.netty:netty-resolver-dns::jar,\
179-
io.netty:netty-codec::jar,\
180-
io.netty:netty-codec-http::jar,\
181-
io.netty:netty-codec-http2::jar,\
182-
io.netty:netty-handler::jar,\
183-
io.netty:netty-resolver::jar,\
184-
io.netty:netty-common::jar,\
185-
io.netty:netty-transport::jar,\
186-
io.netty:netty-buffer::jar,\
187-
com.azure:azure-identity::jar,\
188-
com.azure:azure-identity-providers-core::jar,\
189-
com.azure:azure-identity-providers-jdbc-postgresql::jar,\
190-
com.fasterxml.jackson.core:jackson-core::jar,\
191-
com.fasterxml.jackson.core:jackson-annotations::jar,\
192-
com.fasterxml.jackson.core:jackson-databind::jar,\
193-
com.fasterxml.jackson.dataformat:jackson-dataformat-xml::jar,\
194-
com.fasterxml.jackson.datatype:jackson-datatype-jsr310::jar,\
195-
org.reactivestreams:reactive-streams::jar,\
196-
io.projectreactor:reactor-core::jar,\
197-
com.microsoft.azure:msal4j::jar,\
198-
com.microsoft.azure:msal4j-persistence-extension::jar,\
199-
org.codehaus.woodstox:stax2-api::jar,\
200-
com.fasterxml.woodstox:woodstox-core::jar,\
201-
com.nimbusds:oauth2-oidc-sdk::jar,\
202-
com.nimbusds:content-type::jar,\
203-
com.nimbusds:nimbus-jose-jwt::jar,\
204-
net.minidev:json-smart::jar,\
205-
net.minidev:accessors-smart::jar,\
206-
io.netty:netty-transport-native-unix-common::jar
207-
```
208-
209146
### Build and push a Docker image to the container registry
210147

211148
1. Build the container image.
@@ -274,8 +211,6 @@ Next, create a PostgreSQL Database and configure your container app to connect t
274211

275212
1. Create the database service.
276213

277-
### [Flexible Server](#tab/flexible)
278-
279214
```azurecli-interactive
280215
DB_SERVER_NAME='msdocs-quarkus-postgres-webapp-db'
281216
ADMIN_USERNAME='demoadmin'
@@ -290,24 +225,6 @@ Next, create a PostgreSQL Database and configure your container app to connect t
290225
--sku-name GP_Gen5_2
291226
```
292227

293-
### [Single Server](#tab/single)
294-
295-
```azurecli-interactive
296-
DB_SERVER_NAME='msdocs-quarkus-postgres-webapp-db'
297-
ADMIN_USERNAME='demoadmin'
298-
ADMIN_PASSWORD='<admin-password>'
299-
300-
az postgres server create \
301-
--resource-group $RESOURCE_GROUP \
302-
--name $DB_SERVER_NAME \
303-
--location $LOCATION \
304-
--admin-user $DB_USERNAME \
305-
--admin-password $DB_PASSWORD \
306-
--sku-name GP_Gen5_2
307-
```
308-
309-
---
310-
311228
The following parameters are used in the above Azure CLI command:
312229

313230
* *resource-group* &rarr; Use the same resource group name in which you created the web app, for example `msdocs-quarkus-postgres-webapp-rg`.
@@ -324,24 +241,13 @@ Next, create a PostgreSQL Database and configure your container app to connect t
324241

325242
1. Create a database named `fruits` within the PostgreSQL service with this command:
326243

327-
### [Flexible Server](#tab/flexible)
328-
329244
```azurecli-interactive
330245
az postgres flexible-server db create \
331246
--resource-group $RESOURCE_GROUP \
332247
--server-name $DB_SERVER_NAME \
333248
--database-name fruits
334249
```
335250

336-
### [Single Server](#tab/single)
337-
338-
```azurecli-interactive
339-
az postgres db create \
340-
--resource-group $RESOURCE_GROUP \
341-
--server-name $DB_SERVER_NAME \
342-
--name fruits
343-
```
344-
345251
1. Install the [Service Connector](../service-connector/overview.md) passwordless extension for the Azure CLI:
346252

347253
```azurecli-interactive
@@ -350,8 +256,6 @@ Next, create a PostgreSQL Database and configure your container app to connect t
350256

351257
1. Connect the database to the container app with a system-assigned managed identity, using the connection command.
352258

353-
### [Flexible Server](#tab/flexible)
354-
355259
```azurecli-interactive
356260
az containerapp connection create postgres-flexible \
357261
--resource-group $RESOURCE_GROUP \
@@ -362,18 +266,6 @@ Next, create a PostgreSQL Database and configure your container app to connect t
362266
--managed-identity
363267
```
364268

365-
### [Single Server](#tab/single)
366-
367-
```azurecli-interactive
368-
az containerapp connection create postgres \
369-
--resource-group $RESOURCE_GROUP \
370-
--name my-container-app \
371-
--target-resource-group $RESOURCE_GROUP \
372-
--server $DB_SERVER_NAME \
373-
--database fruits \
374-
--managed-identity
375-
```
376-
377269
## 6. Review your changes
378270

379271
You can find the application URL(FQDN) by using the following command:

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

Lines changed: 1 addition & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@ description: Learn how to bind an Azure Database for PostgreSQL instance to your
44
author: KarlErickson
55
ms.service: spring-apps
66
ms.topic: how-to
7-
ms.date: 09/26/2022
7+
ms.date: 06/04/2024
88
ms.author: karler
99
ms.custom: passwordless-java, devx-track-java, devx-track-extended-java
10-
zone_pivot_group_filename: spring-apps/postgresql-zone-pivot-groups.json
11-
zone_pivot_groups: passwordless-postgresql
1210
---
1311

1412
# Bind an Azure Database for PostgreSQL to your application in Azure Spring Apps
@@ -28,8 +26,6 @@ Microsoft Entra authentication is a mechanism for connecting to Azure Database f
2826

2927
PostgreSQL authentication uses accounts stored in PostgreSQL. If you choose to use passwords as credentials for the accounts, these credentials are stored in the user table. Because these passwords are stored in PostgreSQL, you need to manage the rotation of the passwords by yourself.
3028

31-
::: zone pivot="postgresql-passwordless-flexible-server"
32-
3329
## Prerequisites
3430

3531
* An application deployed to Azure Spring Apps. For more information, see [Quickstart: Deploy your first application to Azure Spring Apps](./quickstart.md).
@@ -121,100 +117,6 @@ Use the following steps to bind your app using a secret.
121117

122118
---
123119

124-
::: zone-end
125-
126-
::: zone pivot="postgresql-passwordless-single-server"
127-
128-
## Prerequisites
129-
130-
* An application deployed to Azure Spring Apps. For more information, see [Quickstart: Deploy your first application to Azure Spring Apps](./quickstart.md).
131-
* An Azure Database for PostgreSQL Single Server instance.
132-
* [Azure CLI](/cli/azure/install-azure-cli) version 2.45.0 or higher.
133-
134-
## Prepare your project
135-
136-
### [Java](#tab/JavaSingle)
137-
138-
Use the following steps to prepare your project.
139-
140-
1. In your project's *pom.xml* file, add the following dependency:
141-
142-
```xml
143-
<dependency>
144-
<groupId>org.springframework.boot</groupId>
145-
<artifactId>spring-boot-starter-data-jpa</artifactId>
146-
</dependency>
147-
<dependency>
148-
<groupId>com.azure.spring</groupId>
149-
<artifactId>spring-cloud-azure-starter-jdbc-postgresql</artifactId>
150-
</dependency>
151-
```
152-
153-
1. In the *application.properties* file, remove any `spring.datasource.*` properties.
154-
155-
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`.
156-
157-
### [Polyglot](#tab/PolyglotSingle)
158-
159-
All the connection strings and credentials will be injected as the environment variables, which can be referenced in your application codes.
160-
161-
You can find the default environment variable names in this doc: [Integrate Azure Database for PostgreSQL with Service Connector](../../service-connector/how-to-integrate-postgres.md#default-environment-variable-names-or-application-properties-and-sample-code)
162-
163-
---
164-
165-
## Bind your app to the Azure Database for PostgreSQL instance
166-
167-
> [!NOTE]
168-
> Service Connectors are created at the deployment level. So if another deployment is created, you need to create the connections again.
169-
170-
### [Passwordless](#tab/PasswordlessSingle)
171-
172-
1. Install the [Service Connector](../../service-connector/overview.md) passwordless extension for the Azure CLI:
173-
174-
```azurecli
175-
az extension add --name serviceconnector-passwordless --upgrade
176-
```
177-
178-
1. Configure Azure Spring Apps to connect to the PostgreSQL Database with a system-assigned managed identity using the `az spring connection create` command.
179-
180-
```azurecli
181-
az spring connection create postgres \
182-
--resource-group $AZ_SPRING_APPS_RESOURCE_GROUP \
183-
--service $AZ_SPRING_APPS_SERVICE_INSTANCE_NAME \
184-
--app $APP_NAME \
185-
--deployment $DEPLOYMENT_NAME \
186-
--target-resource-group $POSTGRES_RESOURCE_GROUP \
187-
--server $POSTGRES_SERVER_NAME \
188-
--database $DATABASE_NAME \
189-
--system-identity
190-
```
191-
192-
### [Password](#tab/SecretsSingle)
193-
194-
Use the following steps to bind your app using a secret.
195-
196-
1. Note the admin username and password of your Azure Database for PostgreSQL account.
197-
198-
1. Connect to the server, create a database named **testdb** from a PostgreSQL client, and then create a new non-admin account.
199-
200-
1. Run the following command to connect to the database with admin username and password.
201-
202-
```azurecli
203-
az spring connection create postgres \
204-
--resource-group $AZ_SPRING_APPS_RESOURCE_GROUP \
205-
--service $AZ_SPRING_APPS_SERVICE_INSTANCE_NAME \
206-
--app $APP_NAME \
207-
--deployment $DEPLOYMENT_NAME \
208-
--target-resource-group $POSTGRES_RESOURCE_GROUP \
209-
--server $POSTGRES_SERVER_NAME \
210-
--database $DATABASE_NAME \
211-
--secret name=$USERNAME secret=$PASSWORD
212-
```
213-
214-
---
215-
216-
::: zone-end
217-
218120
## Next steps
219121

220122
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

Comments
 (0)