0

阅读文档:

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

它说:

应用程序设置哈希表。现有的应用程序设置将被替换,删除任何未提供的设置。

这是否意味着如果我只在该哈希表参数中提供一个值,我的所有应用程序设置变量都会被吹走,而不是在参数中?

4

1 回答 1

1

不,Set-AzWebAppSlot不能只覆盖一个应用程序设置,它会覆盖所有设置。

如果您只想覆盖一个应用程序设置,您可以使用以下命令。

在我的示例中,我只是覆盖了名为setting2value的应用程序设置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

在此处输入图像描述

于 2020-06-24T01:58:33.553 回答