-
Notifications
You must be signed in to change notification settings - Fork 62
/
Copy pathScale_web_app_manually.ps1
33 lines (23 loc) · 1.05 KB
/
Scale_web_app_manually.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Set-Location c:\
Clear-Host
Install-Module -Name Az -Force -AllowClobber -Verbose
#Log into Azure
Connect-AzAccount
#Select the correct subscription
Get-AzSubscription -SubscriptionName "MSDN Platforms" | Select-AzSubscription
# Generates a Random Value
$Random=(New-Guid).ToString().Substring(0,8)
# Variables
$ResourceGroupName="myResourceGroup$random"
$AppName="AppServiceManualScale$random"
$Location="WestEurope"
# Create a Resource Group
New-AzResourceGroup -Name $ResourceGroupName -Location $Location
# Create an App Service Plan
New-AzAppservicePlan -Name AppServiceManualScalePlan -ResourceGroupName $ResourceGroupName -Location $Location -Tier Basic
# Create a Web App in the App Service Plan
New-AzWebApp -Name $AppName -ResourceGroupName $ResourceGroupName -Location $Location -AppServicePlan AppServiceManualScalePlan
# Scale Web App to 2 Workers
Set-AzAppServicePlan -NumberofWorkers 2 -Name AppServiceManualScalePlan -ResourceGroupName $ResourceGroupName
#Clean Up
Remove-AzResourceGroup -Name $ResourceGroupName -Force