繁体   English   中英

为 Azure 文件共享存储帐户部署模板时面临的问题

[英]Facing Issues on Deploying template for Azure File Share Storage Account

我正在尝试创建一个包含文件共享和 rest 服务的存储帐户。 当我执行模板时,它会抛出以下错误。

状态消息:指定的 XML 在语法上无效。 RequestId:5be13537-701a-0056-1f1d-0a506f000000 时间:2021-02-23T19:53:49.1937194Z(代码:InvalidXmlDocument)CorrelationId:21fe81f4-b917-4813-ade5-9b96f3b688d6

存储帐户的 blob、队列、表获取预配不知道为什么它会在文件共享预配上引发错误。 任何帮助家伙。

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "storageAccountname": {
            "type": "String"
        },
        "location": {
            "type": "String"
        },
        "skuname": {
            "type": "String"
        },
        "tags": {
            "type": "Object"
        },
        "accessTier": {
            "type": "String"
        }
    },
    "variables": {},
    "resources": [
        {
            "type": "Microsoft.Storage/storageAccounts",
            "apiVersion": "2020-08-01-preview",
            "name": "[parameters('storageAccountname')]",
            "location": "[parameters('location')]",
            "tags": "[parameters('tags')]",
            "sku": {
                "name": "[parameters('skuname')]",
                "tier": "Standard"
            },
            "kind": "StorageV2",
            "properties": {
                "allowBlobPublicAccess": true,
                "networkAcls": {
                    "bypass": "AzureServices",
                    "virtualNetworkRules": [],
                    "ipRules": [],
                    "defaultAction": "Allow"
                },
                "supportsHttpsTrafficOnly": true,
                "encryption": {
                    "services": {
                        "file": {
                            "keyType": "Account",
                            "enabled": true
                        },
                        "blob": {
                            "keyType": "Account",
                            "enabled": true
                        }
                    },
                    "keySource": "Microsoft.Storage"
                },
                "accessTier": "[parameters('accessTier')]"
            }
        },
        {
            "type": "Microsoft.Storage/storageAccounts/fileServices",
            "apiVersion": "2020-08-01-preview",
            "name": "[concat(parameters('storageAccountname'), '/default')]",
            "dependsOn": [
                "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountname'))]"
            ],
            "sku": {
                "name": "[parameters('skuname')]",
                "tier": "Standard"
            },
            "properties": {
                "protocolSettings": {
                    "smb": {}
                },
                "cors": {
                    "corsRules": []
                },
                "shareDeleteRetentionPolicy": {
                    "enabled": true,
                    "days": 7
                }
            }
        }
    ]
}

是的,当存储帐户类型更改为 StorageV2 时,允许我添加文件共享。

在此azure 快速入门模板中,我们在创建标准存储帐户时不需要提供Microsoft.Storage/storageAccounts/fileServices类型的资源。

当我们只包含类型为StorageV2的资源Microsoft.Storage/storageAccounts时,它将同时提供所有这些服务: blobServicesfileServicesqueueServicestableServices

{
    "type": "Microsoft.Storage/storageAccounts",
    "apiVersion": "2019-06-01",
    "name": "[parameters('storageAccountName')]",
    "location": "[parameters('location')]",
    "kind": "StorageV2",
    "sku": {
        "name": "Standard_LRS",
        "tier": "Standard"
    },
    "properties": {
        "accessTier": "Hot"
    }
},

如果您只想创建文件服务,您可以 select 一种具有高级性能层的FileStorage类型的存储帐户类型。 像这样的工作示例:

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "storageAccountname": {
            "type": "String"
        },
        "location": {
            "type": "String"
        },
        "skuname": {
            "type": "String"
        },
        "tags": {
            "type": "Object"
        }
        // "accessTier": {
        //     "type": "String"
        // }
    },
    "variables": {},
    "resources": [
        {
            "type": "Microsoft.Storage/storageAccounts",
            "apiVersion": "2020-08-01-preview",
            "name": "[parameters('storageAccountname')]",
            "location": "[parameters('location')]",
            "tags": "[parameters('tags')]",
            "sku": {
                "name": "[parameters('skuname')]",
                "tier": "Premium"
            },
            "kind": "FileStorage",
            "properties": {
                "allowBlobPublicAccess": true,
                "networkAcls": {
                    "bypass": "AzureServices",
                    "virtualNetworkRules": [],
                    "ipRules": [],
                    "defaultAction": "Allow"
                },
                "supportsHttpsTrafficOnly": true,
                "encryption": {
                    "services": {
                        "file": {
                            "keyType": "Account",
                            "enabled": true
                        },
                        "blob": {
                            "keyType": "Account",
                            "enabled": true
                        }
                    },
                    "keySource": "Microsoft.Storage"
                }
                // "accessTier": "[parameters('accessTier')]"
            }
        }
    ]
}

有关详细信息,请阅读https://docs.microsoft.com/en-us/azure/storage/common/storage-account-overview#performance-tiers

我遇到了同样的错误,并用空的“SMB”条目将其追踪到“protocolSettings”。 从我的模板中删除该块消除了错误,并且使用默认值创建了资源。

可能没有必要包含文件服务资源类型,但我将包含所有四个(blob、文件、队列和表)作为标准做法,以防我以后想要添加容器/共享/等。 在模板中,因此对他们父母的引用将起作用(并在几个月后查看模板时保持我记忆结构的理智。)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM