Skip to content

Commit af75e97

Browse files
authored
Merge pull request #95731 from mhopkins-msft/image-tutorial
Cleaned up incorrect CLI commands
2 parents 6b9f595 + 69ff8e2 commit af75e97

File tree

1 file changed

+32
-43
lines changed

1 file changed

+32
-43
lines changed

articles/storage/blobs/storage-upload-process-images.md

Lines changed: 32 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
---
22
title: Upload image data in the cloud with Azure Storage | Microsoft Docs
33
description: Use Azure Blob storage with a web app to store app data
4-
author: normesta
4+
author: mhopkins-msft
5+
56
ms.service: storage
67
ms.subservice: blobs
78
ms.topic: tutorial
8-
ms.date: 11/26/2018
9+
ms.date: 11/16/2019
910
ms.author: mhopkins
1011
ms.reviewer: dineshm
1112
---
@@ -50,7 +51,8 @@ Create a resource group with the [az group create](/cli/azure/group) command. An
5051
The following example creates a resource group named `myResourceGroup`.
5152

5253
```azurecli-interactive
53-
az group create --name myResourceGroup --location southeastasia
54+
az group create --name myResourceGroup --location southeastasia
55+
5456
```
5557

5658
## Create a storage account
@@ -60,14 +62,13 @@ The sample uploads images to a blob container in an Azure Storage account. A sto
6062
> [!IMPORTANT]
6163
> In part 2 of the tutorial, you use Azure Event Grid with Blob storage. Make sure to create your storage account in an Azure region that supports Event Grid. For a list of supported regions, see [Azure products by region](https://azure.microsoft.com/global-infrastructure/services/?products=event-grid&regions=all).
6264
63-
In the following command, replace your own globally unique name for the Blob storage account where you see the `<blob_storage_account>` placeholder.
65+
In the following command, replace your own globally unique name for the Blob storage account where you see the `<blob_storage_account>` placeholder.
6466

6567
```azurecli-interactive
66-
blobStorageAccount=<blob_storage_account>
68+
$blobStorageAccount="<blob_storage_account>"
69+
70+
az storage account create --name $blobStorageAccount --location southeastasia --resource-group myResourceGroup --sku Standard_LRS --kind blobstorage --access-tier hot
6771
68-
az storage account create --name $blobStorageAccount \
69-
--location southeastasia --resource-group myResourceGroup \
70-
--sku Standard_LRS --kind blobstorage --access-tier hot
7172
```
7273

7374
## Create Blob storage containers
@@ -79,17 +80,15 @@ Get the storage account key by using the [az storage account keys list](/cli/azu
7980
The *images* container's public access is set to `off`. The *thumbnails* container's public access is set to `container`. The `container` public access setting permits users who visit the web page to view the thumbnails.
8081

8182
```azurecli-interactive
82-
blobStorageAccountKey=$(az storage account keys list -g myResourceGroup \
83-
-n $blobStorageAccount --query [0].value --output tsv)
83+
$blobStorageAccountKey=$(az storage account keys list -g myResourceGroup -n $blobStorageAccount --query [0].value --output tsv)
8484
85-
az storage container create -n images --account-name $blobStorageAccount \
86-
--account-key $blobStorageAccountKey --public-access off
85+
az storage container create -n images --account-name $blobStorageAccount --account-key $blobStorageAccountKey --public-access off
8786
88-
az storage container create -n thumbnails --account-name $blobStorageAccount \
89-
--account-key $blobStorageAccountKey --public-access container
87+
az storage container create -n thumbnails --account-name $blobStorageAccount --account-key $blobStorageAccountKey --public-access container
9088
9189
echo "Make a note of your Blob storage account key..."
9290
echo $blobStorageAccountKey
91+
9392
```
9493

9594
Make a note of your Blob storage account name and key. The sample app uses these settings to connect to the storage account to upload the images.
@@ -104,6 +103,7 @@ The following example creates an App Service plan named `myAppServicePlan` in th
104103

105104
```azurecli-interactive
106105
az appservice plan create --name myAppServicePlan --resource-group myResourceGroup --sku Free
106+
107107
```
108108

109109
## Create a web app
@@ -113,9 +113,10 @@ The web app provides a hosting space for the sample app code that's deployed fro
113113
In the following command, replace `<web_app>` with a unique name. Valid characters are `a-z`, `0-9`, and `-`. If `<web_app>` is not unique, you get the error message: _Website with given name `<web_app>` already exists._ The default URL of the web app is `https://<web_app>.azurewebsites.net`.
114114

115115
```azurecli-interactive
116-
webapp=<web_app>
116+
$webapp="<web_app>"
117117
118118
az webapp create --name $webapp --resource-group myResourceGroup --plan myAppServicePlan
119+
119120
```
120121

121122
## Deploy the sample app from the GitHub repository
@@ -127,27 +128,24 @@ App Service supports several ways to deploy content to a web app. In this tutori
127128
The sample project contains an [ASP.NET MVC](https://www.asp.net/mvc) app. The app accepts an image, saves it to a storage account, and displays images from a thumbnail container. The web app uses the [Microsoft.Azure.Storage](/dotnet/api/overview/azure/storage), [Microsoft.Azure.Storage.Blob](/dotnet/api/microsoft.azure.storage.blob), and the Microsoft.Azure.Storage.Auth namespaces from the Azure Storage client library to interact with Azure storage.
128129

129130
```azurecli-interactive
130-
az webapp deployment source config --name $webapp \
131-
--resource-group myResourceGroup --branch master --manual-integration \
132-
--repo-url https://github.com/Azure-Samples/storage-blob-upload-from-webapp
131+
az webapp deployment source config --name $webapp --resource-group myResourceGroup --branch master --manual-integration --repo-url https://github.com/Azure-Samples/storage-blob-upload-from-webapp
132+
133133
```
134134

135135
# [Node.js V2 SDK](#tab/nodejs)
136136
App Service supports several ways to deploy content to a web app. In this tutorial, you deploy the web app from a [public GitHub sample repository](https://github.com/Azure-Samples/storage-blob-upload-from-webapp-node). Configure GitHub deployment to the web app with the [az webapp deployment source config](/cli/azure/webapp/deployment/source) command.
137137

138138
```azurecli-interactive
139-
az webapp deployment source config --name $webapp \
140-
--resource-group myResourceGroup --branch master --manual-integration \
141-
--repo-url https://github.com/Azure-Samples/storage-blob-upload-from-webapp-node
139+
az webapp deployment source config --name $webapp --resource-group myResourceGroup --branch master --manual-integration --repo-url https://github.com/Azure-Samples/storage-blob-upload-from-webapp-node
140+
142141
```
143142

144143
# [Node.js V10 SDK](#tab/nodejsv10)
145144
App Service supports several ways to deploy content to a web app. In this tutorial, you deploy the web app from a [public GitHub sample repository](https://github.com/Azure-Samples/storage-blob-upload-from-webapp-node-v10). Configure GitHub deployment to the web app with the [az webapp deployment source config](/cli/azure/webapp/deployment/source) command.
146145

147146
```azurecli-interactive
148-
az webapp deployment source config --name $webapp \
149-
--resource-group myResourceGroup --branch master --manual-integration \
150-
--repo-url https://github.com/Azure-Samples/storage-blob-upload-from-webapp-node-v10
147+
az webapp deployment source config --name $webapp --resource-group myResourceGroup --branch master --manual-integration --repo-url https://github.com/Azure-Samples/storage-blob-upload-from-webapp-node-v10
148+
151149
```
152150

153151
---
@@ -159,37 +157,28 @@ az webapp deployment source config --name $webapp \
159157
The sample web app uses the [Azure Storage Client Library](/dotnet/api/overview/azure/storage) to request access tokens, which are used to upload images. The storage account credentials used by the Storage SDK are set in the app settings for the web app. Add app settings to the deployed app with the [az webapp config appsettings set](/cli/azure/webapp/config/appsettings) command.
160158

161159
```azurecli-interactive
162-
az webapp config appsettings set --name $webapp --resource-group myResourceGroup \
163-
--settings AzureStorageConfig__AccountName=$blobStorageAccount \
164-
AzureStorageConfig__ImageContainer=images \
165-
AzureStorageConfig__ThumbnailContainer=thumbnails \
166-
AzureStorageConfig__AccountKey=$blobStorageAccountKey
160+
az webapp config appsettings set --name $webapp --resource-group myResourceGroup --settings AzureStorageConfig__AccountName=$blobStorageAccount AzureStorageConfig__ImageContainer=images AzureStorageConfig__ThumbnailContainer=thumbnails AzureStorageConfig__AccountKey=$blobStorageAccountKey
161+
167162
```
168163

169164
# [Node.js V2 SDK](#tab/nodejs)
170165

171166
The sample web app uses the [Azure Storage Client Library](https://docs.microsoft.com/javascript/api/azure-storage) to request access tokens, which are used to upload images. The storage account credentials used by the Storage SDK are set in the app settings for the web app. Add app settings to the deployed app with the [az webapp config appsettings set](/cli/azure/webapp/config/appsettings) command.
172167

173168
```azurecli-interactive
174-
storageConnectionString=$(az storage account show-connection-string --resource-group $resourceGroupName \
175-
--name $blobStorageAccount --query connectionString --output tsv)
176-
177-
az webapp config appsettings set --name $webapp --resource-group myResourceGroup \
178-
--settings AzureStorageConfig__ImageContainer=images \
179-
AzureStorageConfig__ThumbnailContainer=thumbnails \
180-
AzureStorageConfig__AccountName=$blobStorageAccount \
181-
AzureStorageConfig__AccountKey=$blobStorageAccountKey \
182-
AZURE_STORAGE_CONNECTION_STRING=$storageConnectionString
169+
$storageConnectionString=$(az storage account show-connection-string --resource-group $resourceGroupName --name $blobStorageAccount --query connectionString --output tsv)
170+
171+
az webapp config appsettings set --name $webapp --resource-group myResourceGroup --settings AzureStorageConfig__ImageContainer=images AzureStorageConfig__ThumbnailContainer=thumbnails AzureStorageConfig__AccountName=$blobStorageAccount AzureStorageConfig__AccountKey=$blobStorageAccountKey AZURE_STORAGE_CONNECTION_STRING=$storageConnectionString
172+
183173
```
184174

185175
# [Node.js V10 SDK](#tab/nodejsv10)
186176

187177
The sample web app uses the [Azure Storage Client Library](https://github.com/Azure/azure-storage-js) to request access tokens, which are used to upload images. The storage account credentials used by the Storage SDK are set in the app settings for the web app. Add app settings to the deployed app with the [az webapp config appsettings set](/cli/azure/webapp/config/appsettings) command.
188178

189179
```azurecli-interactive
190-
az webapp config appsettings set --name $webapp --resource-group myResourceGroup \
191-
--settings AZURE_STORAGE_ACCOUNT_NAME=$blobStorageAccount \
192-
AZURE_STORAGE_ACCOUNT_ACCESS_KEY=$blobStorageAccountKey
180+
az webapp config appsettings set --name $webapp --resource-group myResourceGroup --settings AZURE_STORAGE_ACCOUNT_NAME=$blobStorageAccount AZURE_STORAGE_ACCOUNT_ACCESS_KEY=$blobStorageAccountKey
181+
193182
```
194183

195184
---
@@ -389,7 +378,7 @@ router.post('/', uploadStrategy, async (req, res) => {
389378

390379
## Verify the image is shown in the storage account
391380

392-
Sign in to the [Azure portal](https://portal.azure.com). From the left menu, select **Storage accounts**, then select the name of your storage account. Under **Blob Service**, select **Blobs**, then select the **images** container.
381+
Sign in to the [Azure portal](https://portal.azure.com). From the left menu, select **Storage accounts**, then select the name of your storage account. Select **Containers**, then select the **images** container.
393382

394383
Verify the image is shown in the container.
395384

@@ -399,7 +388,7 @@ Verify the image is shown in the container.
399388

400389
To test thumbnail viewing, you'll upload an image to the **thumbnails** container to check whether the app can read the **thumbnails** container.
401390

402-
Sign in to the [Azure portal](https://portal.azure.com). From the left menu, select **Storage accounts**, then select the name of your storage account. Under **Blob Service**, select **Blobs**, then select the **thumbnails** container. Select **Upload** to open the **Upload blob** pane.
391+
Sign in to the [Azure portal](https://portal.azure.com). From the left menu, select **Storage accounts**, then select the name of your storage account. Select **Containers**, then select the **thumbnails** container. Select **Upload** to open the **Upload blob** pane.
403392

404393
Choose a file with the file picker and select **Upload**.
405394

0 commit comments

Comments
 (0)