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
Copy file name to clipboardExpand all lines: articles/service-connector/tutorial-django-webapp-postgres-cli.md
+10-11Lines changed: 10 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,7 @@ In this tutorial, you use the Azure CLI to complete the following tasks:
29
29
## Set up your initial environment
30
30
31
31
### [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.
33
33
34
34
```terminal
35
35
az extension add --name serviceconnector-passwordless --upgrade
@@ -100,7 +100,7 @@ Having issues? [Let us know](https://aka.ms/DjangoCLITutorialHelp).
100
100
APP_SERVICE_NAME="msdocs-mi-web-$RAND_ID"
101
101
DB_SERVER_NAME="msdocs-mi-postgres-$RAND_ID"
102
102
ADMIN_USER="demoadmin"
103
-
ADMIN_PW="ChAnG33#ThsPssWD$RAND_ID"
103
+
ADMIN_PW="{your database password}"
104
104
```
105
105
106
106
> [!IMPORTANT]
@@ -123,7 +123,6 @@ Having issues? [Let us know](https://aka.ms/DjangoCLITutorialHelp).
123
123
--admin-password $ADMIN_PW \
124
124
--sku-name Standard_D2ds_v4
125
125
--active-directory-auth Enabled \
126
-
--public-access 0.0.0.0
127
126
```
128
127
129
128
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).
136
135
* With the sku specified with the `--sku-name` parameter.
137
136
* Create an administrator account with a username and password specified with the `--admin-user` and `--admin-password` parameters.
138
137
* 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.
140
138
141
139
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.)
142
140
@@ -245,21 +243,22 @@ Having issues? Refer first to the [Troubleshooting guide](../app-service/configu
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.
249
247
250
248
```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
251
254
az storage container create \
252
255
--account-name $STORAGE_ACCOUNT_NAME \
253
256
--name photos \
254
257
--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
257
260
```
258
261
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
-
263
262
## Test the Python web app in Azure
264
263
265
264
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 forthe App Service and, if so, uses it to access other Azure resources (storage and PostgreSQLin this case). There's no need to provide storage keys, certificates, or credentials to the App Service to access these resources.
0 commit comments