Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <#
- .SYNOPSIS
- Set Azure app service specific application settings (not web.config)
- .DESCRIPTION
- Set Azure app service specific application settings (not web.config)
- .EXAMPLE
- AzureSetAppSettings -ResourceGroupName "cmc-scm-tst-us-e-rg" -WebAppName "888888sisclientweb01"
- .EXAMPLE
- AzureSetAppSettings -ResourceGroupName "cmc-scm-tst-us-e-rg" -WebAppName "888888sisclientweb01" -Slot "qa"
- .PARAMETER ResourceGroupName
- Resource group name
- .PARAMETER WebAppName
- Web app name
- .PARAMETER Slot
- Optional slot name
- #>
- [CmdletBinding()]
- param(
- [Parameter(Mandatory=$True)]
- [string]
- $ResourceGroupName,
- [Parameter(Mandatory=$True)]
- [string]
- $WebAppName,
- [Parameter(Mandatory=$False)]
- [string]
- $Slot
- )
- $hash = @{}
- if([string]::IsNullOrEmpty($Slot)) {
- Write-Host "Using standard (non-slot) deployment"
- $website = Get-AzureRmWebApp -Name $WebAppName -ResourceGroupName $ResourceGroupName
- $currentAppSettings = $website.SiteConfig.AppSettings
- ForEach ($kvp in $currentAppSettings) {
- $hash[$kvp.Name] = $kvp.Value
- }
- $hash['WEBSITE_LOAD_CERTIFICATES'] = "*"
- $hash['CertificateStoreLocation'] = "CurrentUser"
- Set-AzureRmWebApp -Name $WebAppName -ResourceGroupName $ResourceGroupName -AppSettings $hash
- }
- else {
- Write-Host "Using slot deployment"
- $website = Get-AzureRmWebAppSlot -Name $WebAppName -ResourceGroupName $ResourceGroupName -Slot $Slot
- $currentAppSettings = $website.SiteConfig.AppSettings
- ForEach ($kvp in $currentAppSettings) {
- $hash[$kvp.Name] = $kvp.Value
- }
- $hash['WEBSITE_LOAD_CERTIFICATES'] = "*"
- $hash['CertificateStoreLocation'] = "CurrentUser"
- Set-AzureRmWebAppSlot -Name $WebAppName -ResourceGroupName $ResourceGroupName -AppSettings $hash -Slot $Slot
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement