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

发布于 2025-01-11 23:57:23 字数 3801 浏览 0 评论 0原文

使用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,并尝试使用相同的模板创建另一个存储帐户。它再次失败并出现相同的错误。看起来门户导出的可能存在错误。

Using arm templates, I am able to create a storage account, queues, file services. But the azure devops task fails when I also try to create container.

  "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"
      }
    }
  ]

All the above resources get created except the one related to container Microsoft.Storage/storageAccounts/blobServices/containers. This is the error message:

##[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.

Here is also what I tried. From the portal I created a storage account and container. Then I exported the arm-template, and tried creating another storage account with the same template. It again fails with the same error. Looks like there may be a bug with the one that is exported by portal.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

指尖凝香 2025-01-18 23:57:23

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

您的存储帐户具有 "isVersioningEnabled": false 设置,这意味着不应配置 ImmutableStorageWithVersioning 设置。

通过门户创建容器时,底部的这张图片证实了这一点。

The setting "Enable version-level immutability support" can only be turned on when the storage account has versioning turned on.

Your storage account features the setting "isVersioningEnabled": false, which means the ImmutableStorageWithVersioning setting should not be configured.

This is confirmed by this picture, at the bottom, when creating a container through the portal.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文