Created
February 8, 2017 12:11
-
-
Save Kennethtruyers/135d9d34afc65d0256e94311604ed391 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Update-AppSettings($resourceGroup, $site, $slot, $inputFile) | |
{ | |
$webApp = Get-AzureRMWebAppSlot -ResourceGroupName $resourceGroup -Name $site -Slot $slot | |
$appSettingList = $webApp.SiteConfig.AppSettings | |
$hash = @{} | |
ForEach ($kvp in $appSettingList) { | |
$hash[$kvp.Name] = $kvp.Value | |
} | |
$json = Get-Content -Raw -Path inputFile | ConvertFrom-Json | |
foreach ($item in ($json.PSObject.Members | ?{ $_.MemberType -eq 'NoteProperty'})) { | |
$hash[$item.Name] = $item.Value | |
} | |
Set-AzureRMWebAppSlot -ResourceGroupName $resourceGroup -Name $site -AppSettings $hash -Slot $slot | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment