Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save koenmetsu/ac70d916845020cada8014a253cb4a01 to your computer and use it in GitHub Desktop.
Save koenmetsu/ac70d916845020cada8014a253cb4a01 to your computer and use it in GitHub Desktop.
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