使用异地复制创建存储的 ARM 模板

ARM template to create storage with geo replication

这里是创建存储账户的ARM模板

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "storageAccountType": {
            "type": "string",
            "defaultValue": "Standard_LRS",
            "allowedValues": [
                "Standard_LRS",
                "Standard_ZRS",
                "Standard_GRS",
                "Standard_RAGRS",
                "Premium_LRS"
            ],
            "metadata": {
                "description": "Describes the storage type."
            }
        }
    },
    "resources": [
        ................
        {
            "apiVersion": "2015-06-15",
            "name": "[variables('storageName')]",
            "type": "Microsoft.Storage/storageAccounts",
            "location": "[resourceGroup().location]",
            "dependsOn": [ ],
            "tags": {
                "displayName": "storage"
            },
            "properties": {
                "accountType": "[parameters('storageAccountType')]"
            }
        }
    ]
}

工作得很好,但是当我尝试使用帐户类型 Standard_RAGRS 进行异地复制时 returns 出现错误:

'The storage account named ..... already exists under the subscription.'

我做错了什么?

谢谢

存储帐户资源上的 ARM 模板没有问题。

我能够使用此模板成功配置不同帐户类型的存储帐户。

根据您的错误消息,根本原因是因为您 already have an existing storage account name under the same resource group and same subscription 与您尝试创建的那个。

我可以用上面相同的场景完全重现你的错误。

message":"The storage account named 'abcstorageacct' already exists under the subscription."}}

您可以在后续部署中为 某些 属性更新资源属性,但这因资源和 属性 而异。不幸的是,我不知道允许什么的好清单。

似乎可以改进该错误...