Forked from Kennethtruyers/Update-WebAppSettingsFromJson.ps1
Created
February 8, 2017 13:14
-
-
Save koenmetsu/ac70d916845020cada8014a253cb4a01 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