Skip to content

Instantly share code, notes, and snippets.

@Kennethtruyers
Created February 8, 2017 12:11
Show Gist options
  • Save Kennethtruyers/135d9d34afc65d0256e94311604ed391 to your computer and use it in GitHub Desktop.
Save Kennethtruyers/135d9d34afc65d0256e94311604ed391 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