-
Notifications
You must be signed in to change notification settings - Fork 6
/
AddStickySlotSettingForWebApp.ps1
33 lines (25 loc) · 1.18 KB
/
AddStickySlotSettingForWebApp.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
. .\Functions.ps1 # This script contains the GetResourceGroupForWebApp Function and code of this script is @ https://github.com/puneet-gupta/AzureAppServicePowershellSamples/blob/master/Functions.ps1
$subscriptionId = "31af7401-5a70-49be-80c7-7a6b85da7287"
$webAppName = "powershelldemowebapp"
$slotName = "staging"
Login-AzureRmAccount
Select-AzureRmSubscription -SubscriptionId $subscriptionId
$rgName = GetResourceGroupForWebApp $webAppName
$PropertiesObject = @{"ThisIsSticky" = "stickyValue";}
#You basically set the AppSetting value on the slot
New-AzureRmResource -PropertyObject $PropertiesObject `
-ResourceGroupName $rgName `
-ResourceType Microsoft.Web/sites/slots/config `
-ResourceName $webAppName/$slotName/appsettings `
-ApiVersion 2015-08-01 -Force
# SET slotConfigNames
$stickSlotConfigObject = @{
"connectionStringNames" = @();
"appSettingNames" = @("ThisIsSticky");
}
#The below command sets the "ThisIsSticky" setting as a sticky setting on all the slots
Set-AzureRmResource -PropertyObject $stickSlotConfigObject `
-ResourceGroupName $rgName `
-ResourceType Microsoft.Web/sites/config `
-ResourceName $webAppName/slotConfigNames `
-ApiVersion 2015-08-01 -Force