Skip to content

Commit 7e4a616

Browse files
committed
edits
1 parent 406c809 commit 7e4a616

1 file changed

Lines changed: 13 additions & 15 deletions

File tree

articles/service-connector/tutorial-django-webapp-postgres-cli.md

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ author: maud-lv
66
ms.author: malev
77
ms.service: service-connector
88
ms.topic: how-to
9-
ms.date: 04/14/2026
9+
ms.date: 04/15/2026
1010
ms.custom:
1111
- devx-track-azurecli
1212
- devx-track-python
@@ -45,7 +45,7 @@ You use Azure CLI to complete the following tasks:
4545

4646
1. Make sure your subscription is registered to use the `Microsoft.ServiceLinker` and `Microsoft.DBforPostgreSQL` resource providers. If not, run `az provider register -n Microsoft.[name of service]` to register the providers.
4747

48-
1. Install the following needed Azure CLI extensions:
48+
1. Install the following Azure CLI extensions:
4949

5050
```azurecli
5151
az extension add --name serviceconnector-passwordless --upgrade
@@ -128,13 +128,11 @@ In the code, the `sku` defines the CPU, memory, and cost of the App Service plan
128128

129129
## Create the Postgres database in Azure
130130

131-
Create the Azure Database for PostgreSQL database to store the app information. The [az postgres flexible-server create](/cli/azure/postgres/flexible-server#az-postgres-flexible-server-create) command performs the following actions, which take a few minutes:
131+
Create the Azure Database for PostgreSQL database to store app information. The [az postgres flexible-server create](/cli/azure/postgres/flexible-server#az-postgres-flexible-server-create) command creates an Azure Database for PostgreSQL flexible server in the specified resource group that has:
132132

133-
* Creates an Azure Database for PostgreSQL flexible server in the specified resource group that has:
134-
* Server name specified in the `--name` parameter. The name must be unique across all of Azure.
135-
* SKU specified in the `--sku-name` parameter.
136-
* Administrator account username and password specified in the `--admin-user` and `--admin-password` parameters.
137-
* Creates a database in the server with database name specified in the `--database-name` parameter.
133+
* Server name specified in the `--name` parameter. The name must be unique across all of Azure.
134+
* SKU specified in the `--sku-name` parameter.
135+
* Administrator account username and password specified in the `--admin-user` and `--admin-password` parameters.
138136

139137
1. Create the Azure Database for PostgreSQL server. If prompted to enable access to the current client IP address, enter `y` for yes.
140138

@@ -149,7 +147,7 @@ Create the Azure Database for PostgreSQL database to store the app information.
149147
--microsoft-entra-auth Enabled
150148
```
151149

152-
1. If not prompted to enable access to your current client IP address, configure a firewall rule on your server with the [az postgres flexible-server firewall-rule create](/cli/azure/postgres/flexible-server/firewall-rule) command. This rule allows your local environment access to the server.
150+
1. If you weren't prompted to enable access to your current client IP address, configure a firewall rule on your server with the [az postgres flexible-server firewall-rule create](/cli/azure/postgres/flexible-server/firewall-rule) command. This rule allows your local environment access to the server.
153151
154152
```azurecli
155153
IP_ADDRESS=<your IP address>
@@ -179,7 +177,7 @@ Create the Azure Database for PostgreSQL database to store the app information.
179177

180178
Use [az webapp connection create postgres-flexible](/cli/azure/webapp/connection/create#az-webapp-connection-create-postgres-flexible) to add a service connector that connects the Azure web app to the Postgres database using passwordless managed identity authentication. The following command configures Azure Database for PostgreSQL to use managed identity and Azure role-based access control. The command output lists the actions Service Connector takes.
181179

182-
The command creates creates an environment variable named `AZURE_POSTGRESQL_CONNECTIONSTRING` that provides the database connection information for the app. The app code accesses app environment variables with statements like `os.environ.get('AZURE_POSTGRESQL_HOST')`. For more information, see [Access environment variables](/azure/app-service/configure-language-python#access-environment-variables).
180+
The command creates an environment variable named `AZURE_POSTGRESQL_CONNECTIONSTRING` that provides the database connection information for the app. The app code accesses app environment variables with statements like `os.environ.get('AZURE_POSTGRESQL_HOST')`. For more information, see [Access environment variables](/azure/app-service/configure-language-python#access-environment-variables).
183181

184182
```azurecli
185183
az webapp connection create postgres-flexible \
@@ -215,7 +213,7 @@ Use [az webapp connection create storage-blob](/cli/azure/webapp/connection/crea
215213
--output tsv)
216214
STORAGE_ACCOUNT_NAME=$(cut -d . -f1 <<< $(cut -d / -f3 <<< $STORAGE_ACCOUNT_URL))
217215
```
218-
1. Update the storage account to allow blob public access for the app users to access images.
216+
1. Update the storage account to allow blob public access for app users to access photos.
219217

220218
```azurecli
221219
az storage account update \
@@ -241,17 +239,17 @@ Use [az webapp connection create storage-blob](/cli/azure/webapp/connection/crea
241239

242240
## Test the Python web app in Azure
243241

244-
The app uses the [azure.identity](https://pypi.org/project/azure-identity/) package and its `DefaultAzureCredential` class. When the app is running in Azure, The `DefaultAzureCredential` automatically detects when a managed identity exists for the App Service, and uses it to access the Azure Storage and Azure Database for PostgreSQL resources. You don't need to provide storage keys, certificates, or credentials to App Service to access these resources.
242+
The app uses the [azure.identity](https://pypi.org/project/azure-identity/) package and its `DefaultAzureCredential` class. When the app is running in Azure, the `DefaultAzureCredential` automatically detects when a managed identity exists for the App Service, and uses it to access the Azure Storage and Azure Database for PostgreSQL resources. You don't need to provide storage keys, certificates, or credentials to App Service to access these resources.
245243
246-
1. Browse to the deployed application at the URL `https://$APP_SERVICE_NAME.azurewebsites.net`, or by selecting the **Default domain** link on the Azure portal app page. It can take a minute or two for the app to start. If you see a default app page that isn't the sample app, wait a minute and refresh the browser.
244+
1. Browse to the deployed application at the URL `https://$APP_SERVICE_NAME.azurewebsites.net`. It can take a minute or two for the app to start. If you see a default app page that isn't the sample app, wait a minute and refresh the browser.
247245

248246
1. Test the functionality of the sample app by adding a restaurant and some reviews with photos for the restaurant. The app should resemble the following screenshot:
249247

250248
:::image type="content" source="media/tutorial-django-webapp-postgres-cli/example-of-review-sample-app-production-deployed-small.png" lightbox="media/tutorial-django-webapp-postgres-cli/example-of-review-sample-app-production-deployed.png" alt-text="Screenshot of the sample app showing restaurant review functionality using App Service, Azure Database for PostgreSQL, and Azure Storage." :::
251249

252250
## Clean up resources
253251

254-
If you don't want to keep the app or resources you created for this tutorial, you can delete the resource group that contains the resources to avoid ongoing charges. Be sure you no longer need the resources before using the command.
252+
To avoid ongoing charges, you can delete the resource group that contains the resources you created for this tutorial. Be sure you no longer need the app or the resources before running the command.
255253

256254
```azurecli
257255
az group delete --name $RESOURCE_GROUP_NAME --no-wait
@@ -261,7 +259,7 @@ Deleting all the resources can take some time. The `--no-wait` argument allows t
261259

262260
## Troubleshooting
263261

264-
If you have issues with this tutorial, see the following resources:
262+
If you have issues running this tutorial, see the following resources:
265263

266264
- [Troubleshoot Linux Python apps for Azure App Service](/azure/app-service/configure-language-python#troubleshooting)
267265
- [Request support](https://aka.ms/DjangoCLITutorialHelp)

0 commit comments

Comments
 (0)