【问题标题】:How to create an azure blob storage using Arm template?如何使用 Arm 模板创建 azure blob 存储?
【发布时间】:2019-07-23 09:30:08
【问题描述】:

需要为 azure blob 存储创建一个 ARM 模板并在其中添加一个容器。任何人都可以启发我。提前致谢。

【问题讨论】:

  • 在我之前的回答中,我已经为您提供了包含您需要的模板的仓库的链接,这有什么问题吗?
  • 在那个答案中,我无法理解它是如何制作容器的,或者它定义了存储帐户的创建位置。
  • 你说的是powershell吗?有什么不清楚的地方?
  • 你给我发了一个 arm 模板的 github 链接,我看不懂
  • 如果该 powershell 一切正常,您应该接受这个答案,至于 arm 模板,here's the link 到完全符合您要求的模板

标签: azure azure-blob-storage azure-resource-manager


【解决方案1】:

创建一个Azure Storage Account and Blob Container on Azure

如何创建new storage account.

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

}

将 JSON 添加到您的 ARM 模板将确保使用指定的设置和参数创建一个新的存储帐户。 How to create ARM templates. 现在为这个存储帐户添加一个容器!为此,您需要向此模板添加 blobServices/containers 类型的新资源。

{
"name": "[parameters('storageAccountName')]",
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2018-02-01",
"location": "[resourceGroup().location]",
"kind": "StorageV2",
"sku": {
    "name": "Standard_LRS",
    "tier": "Standard"
},
"properties": {
    "accessTier": "Hot"
},
"resources": [{
    "name": "[concat('default/', 'theNameOfMyContainer')]",
    "type": "blobServices/containers",
    "apiVersion": "2018-03-01-preview",
    "dependsOn": [
        "[parameters('storageAccountName')]"
    ],
    "properties": {
        "publicAccess": "Blob"
    }
}]

}

部署这将确保在存储帐户内创建一个名为 NameContainer 的容器。

{
  "name": "[variables('StorageAccount')]",
  "type": "Microsoft.Storage/storageAccounts",
  "location": "[resourceGroup().location]",
  "apiVersion": "2016-01-01",
  "sku": {
    "name": "[parameters('StorgaeAccountType')]"
  },
  "dependsOn": [],
  "tags": {
    "displayName": "Blob Storage"
  },
  "kind": "Storage",
  "resources": [
    {
      "type": "blobServices/containers",
      "apiVersion": "2018-03-01-preview",
      "name": "[concat('default/', variables('blobContainer'))]",
      "properties": {
        "publicAccess": "Blob"
      },
      "dependsOn": [
        "[variables('StorageAccount')]"
      ]
    }
  ]
}

让我们知道以上内容是否有帮助,或者您在此问题上需要进一步帮助。

【讨论】:

    猜你喜欢
    • 2019-01-17
    • 2020-09-04
    • 1970-01-01
    • 1970-01-01
    • 2021-04-24
    • 2022-07-19
    • 1970-01-01
    • 1970-01-01
    • 2019-06-03
    相关资源
    最近更新 更多