Skip to content

Instantly share code, notes, and snippets.

@isjwuk
Created February 23, 2022 11:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isjwuk/de4fd11064bf4a09a323c2e46bc86871 to your computer and use it in GitHub Desktop.
Save isjwuk/de4fd11064bf4a09a323c2e46bc86871 to your computer and use it in GitHub Desktop.
#Create Resources for testing AZCopy in a Web App
#See https://isjw.uk/post/azure/azure-app-service-azcopy/
#Creates an Azure Resource Group containing an App Service Plan, a Web App, and a Storage Account.
#Set some parameters
$location="NorthEurope"
$resourceGroupName= "azcopytest-rsg"
$webAppName="azcopytest-web"
$appServicePlanName="azcopytest-asp"
$storageAccountName=("azcopyteststo"+((New-Guid) -replace ("-",""))).Substring(0,20)
$storageContainerName="azcopytest"
#Create Resource Group
"-- Creating Resource Group"
New-AzResourceGroup -Location $location -Name $resourceGroupName
#Create ServicePlan
"-- Creating Service Plan"
New-AzAppServicePlan -ResourceGroupName $resourceGroupName -Name $appServicePlanName -Location $location -Tier Free -Linux
#Create Web App
"-- Creating Web App"
New-AzWebApp -ResourceGroupName $resourceGroupName -Name $webAppName -Location $location -AppServicePlan $appServicePlanName
#Set Framework to PHP 7.4 (7.0 does not feature wget)
az webapp config set --resource-group $resourceGroupName --name $webAppName --linux-fx-version --% "PHP|7.4"
#Create Storage Account
New-AzStorageAccount -ResourceGroupName $resourceGroupName -Name $storageAccountName -Location $location -SkuName Standard_LRS
#Create Container
New-AzStorageContainer -Name $storageContainerName -Context (Get-AzStorageAccount -Name $storageAccountName -ResourceGroupName $resourceGroupName).Context
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment