无法通过ARM模板在Azure存储中创建容器

问题描述 投票:0回答:1

使用arm模板,我能够创建存储帐户、队列、文件服务。但是当我也尝试创建容器时,azure devops 任务失败了。

  "resources": [
    {
      "name": "[parameters('storageAccountName')]",
      "type": "Microsoft.Storage/storageAccounts",
      "apiVersion": "2021-08-01",
      "location": "[parameters('location')]",
      "properties": {
        "accessTier": "[parameters('accessTier')]",
        "minimumTlsVersion": "TLS1_2",
        "supportsHttpsTrafficOnly": true,
        "allowBlobPublicAccess": true,
        "allowSharedKeyAccess": true,
        "allowCrossTenantReplication": true,
        "defaultToOAuthAuthentication": false,
        "networkAcls": {
          "bypass": "AzureServices",
          "defaultAction": "Allow",
          "ipRules": []
        },
        "isHnsEnabled": "[parameters('isHnsEnabled')]"
      },
      "dependsOn": [],
      "sku": {
        "name": "[parameters('accountType')]"
      },
      "kind": "[parameters('kind')]",
      "tags": {
        "InstanceId": "[parameters('instanceId')]"
      }
    },
    {
      "name": "[concat(parameters('storageAccountName'), '/default')]",
      "type": "Microsoft.Storage/storageAccounts/blobServices",
      "apiVersion": "2021-08-01",
      "properties": {
        "restorePolicy": {
          "enabled": false
        },
        "deleteRetentionPolicy": {
          "enabled": true,
          "days": 7
        },
        "containerDeleteRetentionPolicy": {
          "enabled": true,
          "days": 7
        },
        "changeFeed": {
          "enabled": false
        },
        "isVersioningEnabled": false
      },
      "dependsOn": [
        "[concat('Microsoft.Storage/storageAccounts/', parameters('storageAccountName'))]"
      ]
    },
    {
      "name": "[concat(parameters('storageAccountName'), '/default')]",
      "type": "Microsoft.Storage/storageAccounts/fileservices",
      "apiVersion": "2021-08-01",
      "properties": {
        "shareDeleteRetentionPolicy": {
          "enabled": true,
          "days": 7
        }
      },
      "dependsOn": [
        "[concat('Microsoft.Storage/storageAccounts/', parameters('storageAccountName'))]",
        "[concat(concat('Microsoft.Storage/storageAccounts/', parameters('storageAccountName')), '/blobServices/default')]"
      ]
    },
    {
      "type": "Microsoft.Storage/storageAccounts/blobServices/containers",
      "apiVersion": "2021-08-01",
      "name": "[concat(parameters('storageAccountName'), '/default/builds')]",
      "dependsOn": [
        "[concat('Microsoft.Storage/storageAccounts/', parameters('storageAccountName'))]",
        "[concat(concat('Microsoft.Storage/storageAccounts/', parameters('storageAccountName')), '/blobServices/default')]"
      ],
      "properties": {
          "immutableStorageWithVersioning": {
              "enabled": false
          },
          "defaultEncryptionScope": "$account-encryption-key",
          "denyEncryptionScopeOverride": false,
          "publicAccess": "None"
      }
    }
  ]

除了与容器相关的资源

Microsoft.Storage/storageAccounts/blobServices/containers
之外,上述所有资源均已创建。这是错误消息:

##[error]At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.
##[error]Details:
##[error]FeatureNotSupportedForAccount: ImmutableStorageWithVersioning is not supported for the account.
##[error]Check out the troubleshooting guide to see if your issue is addressed: https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/azure-resource-group-deployment?view=azure-devops#troubleshooting
##[error]Task failed while creating or updating the template deployment.

这也是我尝试过的。我从门户创建了一个存储帐户和容器。然后我导出了arm-template,并尝试使用相同的模板创建另一个存储帐户。它再次失败并出现相同的错误。看来portal导出的可能有bug。

azure azure-devops azure-blob-storage azure-storage
1个回答
0
投票

仅当存储帐户打开版本控制时才能打开“启用版本级不变性支持”设置。

您的存储帐户具有设置

"isVersioningEnabled": false
,这意味着不应配置
ImmutableStorageWithVersioning
设置。

通过门户创建容器时,this picture, at the bottom 确认了这一点。

© www.soinside.com 2019 - 2024. All rights reserved.