Skip to content

Commit 323c9d7

Browse files
author
Bryce Chen
committed
fix comments
1 parent e6fb96a commit 323c9d7

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

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

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ In this tutorial, you use the Azure CLI to complete the following tasks:
2929
## Set up your initial environment
3030

3131
### [CloudShell](#tab/cloudshell)
32-
Lauch from CloudShell from the Azure Portal and install the service connector passwordless extension for Azure CLI
32+
Lauch from [Azure Cloud Shell](https://learn.microsoft.com/en-us/azure/cloud-shell/overview) from the Azure Portal and install the service connector passwordless extension for Azure CLI.
3333

3434
```terminal
3535
az extension add --name serviceconnector-passwordless --upgrade
@@ -100,7 +100,7 @@ Having issues? [Let us know](https://aka.ms/DjangoCLITutorialHelp).
100100
APP_SERVICE_NAME="msdocs-mi-web-$RAND_ID"
101101
DB_SERVER_NAME="msdocs-mi-postgres-$RAND_ID"
102102
ADMIN_USER="demoadmin"
103-
ADMIN_PW="ChAnG33#ThsPssWD$RAND_ID"
103+
ADMIN_PW="{your database password}"
104104
```
105105

106106
> [!IMPORTANT]
@@ -123,7 +123,6 @@ Having issues? [Let us know](https://aka.ms/DjangoCLITutorialHelp).
123123
--admin-password $ADMIN_PW \
124124
--sku-name Standard_D2ds_v4
125125
--active-directory-auth Enabled \
126-
--public-access 0.0.0.0
127126
```
128127

129128
If the `az` command isn't recognized, be sure you have the Azure CLI installed as described in [Set up your initial environment](#set-up-your-initial-environment).
@@ -136,7 +135,6 @@ Having issues? [Let us know](https://aka.ms/DjangoCLITutorialHelp).
136135
* With the sku specified with the `--sku-name` parameter.
137136
* Create an administrator account with a username and password specified with the `--admin-user` and `--admin-password` parameters.
138137
* Create a database which name is specified with the `--database-name` parameter.
139-
* Enables complete public access, which you can control using the `--public-access` parameter.
140138

141139
1. 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 connect to the server. (If you're using the Azure Cloud Shell, you can skip this step.)
142140
@@ -245,21 +243,22 @@ Having issues? Refer first to the [Troubleshooting guide](../app-service/configu
245243
STORAGE_ACCOUNT_NAME=$(cut -d . -f1 <<< $(cut -d / -f3 <<< $STORAGE_ACCOUNT_URL))
246244
```
247245

248-
1. Create a container called *photos* in the storage account with the [az storage container create](/cli/azure/storage/container#az-storage-container-create) command. Allow anonymous read (public) access to blobs in the newly created container.
246+
1. Create a container called `photos` in the storage account with the [az storage container create](/cli/azure/storage/container#az-storage-container-create) command. Allow anonymous read (public) access to blobs in the newly created container.
249247

250248
```azurecli
249+
# Set the BLOB_ENDPOINT variable
250+
BLOB_ENDPOINT=$(az storage account show --name $STORAGE_ACCOUNT_NAME --query "primaryEndpoints.blob" | sed 's/"//g')
251+
echo $BLOB_ENDPOINT
252+
253+
# Create the storage container using the BLOB_ENDPOINT variable
251254
az storage container create \
252255
--account-name $STORAGE_ACCOUNT_NAME \
253256
--name photos \
254257
--public-access blob \
255-
--account-key $(az storage account keys list --account-name $STORAGE_ACCOUNT_NAME \
256-
--query [0].value --output tsv)
258+
--auth-mode login \
259+
--blob-endpoint $BLOB_ENDPOINT
257260
```
258261

259-
> [!NOTE]
260-
> For brevity, this command uses the storage account key to authorize with the storage account. For most scenarios, Microsoft's recommended approach is to use Microsoft Entra ID and Azure (RBAC) roles. For a quick set of instructions, see [Quickstart: Create, download, and list blobs with Azure CLI](/azure/storage/blobs/storage-quickstart-blobs-cli#create-a-container). Note that several Azure roles permit you to create containers in a storage account, including "Owner", "Contributor", "Storage Blob Data Owner", and "Storage Blob Data Contributor".
261-
To learn more about anonymous read access to blob data, see [Configure anonymous read access for containers and blobs](/azure/storage/blobs/anonymous-read-access-configure).
262-
263262
## Test the Python web app in Azure
264263

265264
The sample Python app uses the [azure.identity](https://pypi.org/project/azure-identity/) package and its `DefaultAzureCredential` class. When the app is running in Azure, `DefaultAzureCredential` automatically detects if a managed identity exists for the App Service and, if so, uses it to access other Azure resources (storage and PostgreSQL in this case). There's no need to provide storage keys, certificates, or credentials to the App Service to access these resources.

0 commit comments

Comments
 (0)