`az webapp config set`后`healthCheckPath`保持为空

问题描述 投票:0回答:1

我正在尝试在数百个网络应用程序上自动启用健康检查功能。 对于上下文,我已经在同一 az 上下文中的同一测试应用程序上成功使用了

az webapp update
。 尽管还有 2 个附加字段需要配置,但我发现的所有示例都表明以下代码行足以启用运行状况检查并设置路径。

az webapp config set --resource-group "rg123" --name "123-WebApp-45678" --generic-configurations  '{"healthCheckPath": "/910/Login?ReturnUrl=%2F"}'

无论我是否在 Azure 门户中手动配置了运行状况检查(出于测试目的而进行,后来被禁用),我都可以在运行代码时返回的属性中清楚地看到

"healthCheckPath": null,

当我运行原始代码时:

az webapp config set --resource-group "rg123" --name "123-WebApp-45678" --generic-configurations  '{"healthCheckPath": "/910/Login?ReturnUrl=%2F"}'

"healthCheckPath"
的值没有变化。事实上,这个值似乎并不能反映 webapp 的实际状态。

我需要 CLI 解决方案(或 PowerShell,如果需要)来启用运行状况检查功能并设置

"healthCheckPath"

这是我的语法吗?我是否使用过时的信息进行操作? 同样,我的其他 CLI 交互也成功了,Azure 上下文没有发生任何变化。

azure-cli azure-webapps
1个回答
0
投票

使用

az webapp config set
将像您已经执行的那样更新 Web 应用程序的配置设置。

我使用了与您相同的命令结构,并且能够使用给定路径启用运行状况检查功能,如下所示。

az webapp config set -g <resourcegroup> -n <webapp> --generic-configurations '{"healthCheckPath": "/910/Login?ReturnUrl=%2F"}'

enter image description here

enter image description here

我访问了下面的资源网页,它也在

site config property >> health check path
下可见。

https://resources.azure.com/

enter image description here

注意: 将 Az CLI 版本升级到最新版本,同时使用

az cache purge
命令清除缓存并尝试执行相同的命令。

或者,您可以使用

Set-AzWebApp
PowerShell 命令来更新 Web 应用程序的站点配置。

请参阅 Github 了解 PowerShell 方法。

© www.soinside.com 2019 - 2024. All rights reserved.