天蓝色命令行界面。是否可以 update/set Web 应用程序的默认文档?

Azure CLI. Is it possible to update/set default documents for web app?

我在 Azure 上有一个 Web 应用程序,我想通过 azure cli 2.0 在默认文档中添加一个值 app_offline.htm

我查看了 az webapp config appsettings set,但这设置了配置而不是默认文档。

有人遇到过吗?
是否有通过 CLI 而不是通过 Azure 手动执行此操作的解决方案 UI?

当然可以。

您可以尝试下面的命令,替换 <yourresourcegroup><yourwebappname>,它在我这边很好用。

az resource update --resource-group <yourresourcegroup> --resource-type "Microsoft.Web/sites/config" --name <yourwebappname>/config/web --add properties.defaultDocuments app_offline.htm

目前无法在 Azure CLI 2.0 中更改该设置,但如果您可以提交问题here(最好是来自客户)。

不过,您今天可以使用 Azure PowerShell 来实现这一目标。

$webapp = Get-AzureRmWebApp -ResourceGroupName rg -Name name
$webapp.SiteConfig.DefaultDocuments.Add("new.html")
Set-AzureRmWebApp $webapp