Home > Enterprise >  Check web app config settings - Microsoft Azure
Check web app config settings - Microsoft Azure

Time:11-01

I am working through a tutorial on the Microsoft Learn area for uploading image data in the cloud with Azure storage.

The tutorial instructs users to deploy a web app from a public Github sample repository, configure web app settings, and then save it to a storage account.

I have completed the steps: Hi there,

I am working through a tutorial on the Microsoft Learn area for uploading image data in the cloud with Azure storage.

enter image description here

I used powershell instead of the azure cli and noticed the powershell commands are incorrect. What I used to set the Application

First creating a map and then updating the app settings (Old settings will be deleted):

 $mysettings = @{
   "AzureStorageConfig__ImageContainer"="images";
   "AzureStorageConfig__AccountName"=$blobStorageAccount;
   "AzureStorageConfig__ThumbnailContainer"="thumbnails";
   "AzureStorageConfig__AccountKey"=$blobStorageAccountKey;
}

$mysettings 

Set-AzWebApp -AppSettings $mysettings -Name "myuniquewebapp1337" -ResourceGroupName "demoteestapprgname1337"

Container result after uploading an image: And the result in the container

Hopefully this helps.

Kind regards

CodePudding user response:

I have used the PowerShell commands and able to upload and view images without any issues.

Please check the below commands and follow the same without any change.

New-AzResourceGroup -Name -Location southeastasia

$blobStorageAccount="myblobha"

New-AzStorageAccount -ResourceGroupName myRGroup -Name $blobStorageAccount -SkuName Standard_LRS -Location southeastasia -Kind StorageV2 -AccessTier Hot


$blobStorageAccountKey = ((Get-AzStorageAccountKey -ResourceGroupName myRGroup -Name $blobStorageAccount)| Where-Object {$_.KeyName -eq "key1"}).Value
$blobStorageContext = New-AzStorageContext -StorageAccountName $blobStorageAccount -StorageAccountKey $blobStorageAccountKey

New-AzStorageContainer -Name images -Context $blobStorageContext
New-AzStorageContainer -Name thumbnails -Permission Container -Context $blobStorageContext

New-AzAppServicePlan -ResourceGroupName myRGroup -Name myAppServiceP -Tier "Free"

Create Azure Web App

New-AzWebApp -ResourceGroupName myRGroup -Name "HarshithaSampleOct" -Location "West US" -AppServicePlan "myAppServiceP"

Get the sample app from the GitHub repository

az webapp deployment source config --name HarshithaSampleOct --resource-group myRGroup --branch master --manual-integration --repo-url https://github.com/Azure-Samples/storage-blob-upload-from-webapp

Configure web app settings

az webapp config appsettings set --name HarshithaSampleOct --resource-group myRGroup --settings AzureStorageConfig__AccountName=$blobStorageAccount AzureStorageConfig__ImageContainer=images AzureStorageConfig__ThumbnailContainer=thumbnails AzureStorageConfig__AccountKey=$blobStorageAccountKey

Now browse the URL and upload the image.

Is there a way I can check my web app configuration settings, including viewing the linked storage account?

To check the Azure App Configuration Settings, Navigate to Azure Portal => Your Web App => Configuration => Application Settings enter image description here

To view the storage Account in Azure Portal, Go to the resource group myRGroup which you have created and click on the Storage Account myblobha

enter image description here

In Storage Account => Containers => Click on Images, you can see the uploaded images.

enter image description here

  • Related