使用ARM模板启用Azure StorageV2静态网站(预览)功能

Mar*_*ndl 9 azure azure-storage azure-storage-blobs azure-resource-manager

我试图编写一个ARM模板,用新的静态网站(预览)功能创建一个存储帐户:

在此输入图像描述

当我转到Automation Script刀片时,我在ARM模板中看不到任何相关设置:

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "storageAccounts_spastore_name": {
            "defaultValue": "spastore",
            "type": "String"
        }
    },
    "variables": {},
    "resources": [
        {
            "type": "Microsoft.Storage/storageAccounts",
            "sku": {
                "name": "Standard_LRS",
                "tier": "Standard"
            },
            "kind": "StorageV2",
            "name": "[parameters('storageAccounts_spastore_name')]",
            "apiVersion": "2018-02-01",
            "location": "westeurope",
            "tags": {
                "purpose": "example"
            },
            "scale": null,
            "properties": {
                "networkAcls": {
                    "bypass": "AzureServices",
                    "virtualNetworkRules": [],
                    "ipRules": [],
                    "defaultAction": "Allow"
                },
                "supportsHttpsTrafficOnly": false,
                "encryption": {
                    "services": {
                        "file": {
                            "enabled": true
                        },
                        "blob": {
                            "enabled": true
                        }
                    },
                    "keySource": "Microsoft.Storage"
                },
                "accessTier": "Hot"
            },
            "dependsOn": []
        }
    ]
}
Run Code Online (Sandbox Code Playgroud)

我也没有在Azure资源浏览器中看到任何相关设置.我知道我必须使用更新的API版本,但我不知道如何使用ARM模板启用该功能?

Gau*_*tri 8

我认为你不能(至少截至今天).ARM模板用于控制,Control PlaneStatic Websites Settings要素的一部分Data Plane是通过访问来公开的Storage Service REST API.

随着RBACAzure存储(以及Azure AD角色)的发布,我看到Storage Service REST API中的一些操作变得可用Storage Resource Provider API,所以我的猜测是这个功能迟早会在​​那里暴露出来.然后,您应该能够通过ARM模板进行配置.

  • 有人知道这是否已经可以通过ARM模板实现? (4认同)
  • Hugo Barona - 看起来不是,但你可以使用这种方法http://www.frankysnotes.com/2019/03/deploy-automatically-static-website.html (2认同)
  • 刚刚与 Microsoft 通电话,他们建议的方法是使用 PowerShell 脚本在部署后启用此功能。它在 ARM 中仍然不是可用的选项。 (2认同)
  • 您还可以使用模板中的部署脚本来执行此操作:https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/deployment-script-template (2认同)