TechnoFobic
TechnoFobic

Reputation: 63

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?

Upvotes: 4

Views: 3157

Answers (3)

jayt.dev
jayt.dev

Reputation: 1015

You can now create blob containers using ARM templates.

See this answer here .

Upvotes: 0

clericc
clericc

Reputation: 305

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.

Upvotes: 3

Gaurav Mantri
Gaurav Mantri

Reputation: 136286

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.

Upvotes: 4

Related Questions