简体   繁体   中英

Creating Container using Azure Resource Manager Template

Is there a way to create a container when creating a Azure storage account using ARM template?

If this construct is not available, is there a way to write any extension that can do it at ARM deployment time?

As of today, no. You cannot create a container through ARM template. This is because ARM is for managing control plane for Azure Resources like creating/updating/deleting storage accounts while creating containers come under managing data plane and you would need to use Storage REST API for that.

Possible now (don't know since when):

{
  "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": { ...  },
  "variables": { ... },
  "resources": [
    {
      "type": "Microsoft.Storage/storageAccounts",
      "name": "[variables('accountName')]",
      "apiVersion": "2018-02-01",
      "location": "westeurope",
      "kind": "BlobStorage",
      "sku": {
        "name": "Standard_LRS",
        "tier": "Standard"
      },
      "tags": {},
      "dependsOn": [],
      "properties": {
        "accessTier": "Cool"
      }
    },
    {
      "type": "Microsoft.Storage/storageAccounts/blobServices/containers",
      "apiVersion": "2018-03-01-preview",
      "name": "[concat(variables('accountName'), '/default/', variables('containerName')]",
      "dependsOn": [
        "[variables('accountName')]"
      ]
    }
  ]
}

I am pretty sure this can be done as a subresource inside the storage account and be further refined.

You can now create blob containers using ARM templates.

See this answer here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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