Alex. A
Alex. A

Reputation: 1352

Can Set-AzWebAppSlot overwrite just 1 Application Setting?

Reading the documentation:

https://learn.microsoft.com/en-us/powershell/module/az.websites/set-azwebappslot?view=azps-4.3.0

It says:

App Settings HashTable. Existing App Settings will be replaced, removing any settings that are not provided.

Does that mean if I only provide one value in that hashtable parameter, all my app settings variable get blown away that aren't in parameter?

Upvotes: 0

Views: 297

Answers (1)

Joy Wang
Joy Wang

Reputation: 42043

No, the Set-AzWebAppSlot cannot overwrite just one app setting, it will overwrite all the settings.

If you want to overwrite just one app setting, you could use the commands below.

In my sample, I just overwrite the app setting named setting2 with the value value2.

$r = Invoke-AzResourceAction -ResourceGroupName <group-name> -ResourceType Microsoft.Web/sites/slots/config -ResourceName "<webapp-name>/<slot-name>/appsettings" -Action list -ApiVersion 2018-02-01 -Force
$r.Properties.setting2 = "value2"
New-AzResource -ResourceGroupName <group-name> -ResourceType Microsoft.Web/sites/slots/config -ResourceName "<webapp-name>/<slot-name>/appsettings" -Properties $r.properties -ApiVersion 2018-02-01 -Force

enter image description here

Upvotes: 1

Related Questions