如何使用脚本 enable/disable blob 服务上的静态网站

How to enable/disable staticwebsite on blob service using script

为了以编程方式自动启用 blob 服务上的静态网站。 属性 字段应该允许什么?我找不到与此类似的内容 Microsoft.Storage/storageAccounts/blobService/staticWebsite.

谁能帮我解决这个问题?

确实,您可以使用一些 Azure CLI 命令来实现。

# To query the current status of the property
az storage blob service-properties show --account-name <your-storage-account> --query 'staticWebsite.enabled'

要设置切换staticWebsite.enabled 属性,您可以使用az storage blob service-properties update命令如下:

az storage blob service-properties update --account-name <your-storage-account> --static-website

上面的 Azure PowerShell 等价物是 Enable-AzStorageStaticWebsite and Disable-AzStorageStaticWebsite cmdlets