2

I am working to create Azure Storage Account with Container using ARM templates. I have followed azure quick-start templates for reference.

I have used the following lines of code for creating Storage Account with Container.

"resources": [
{
  "type": "Microsoft.Storage/storageAccounts",
  "apiVersion": "2019-06-01",
  "name": "[parameters('storageAccountName')]",
  "location": "[parameters('location')]",
  "sku": {
    "name": "Standard_LRS",
    "tier": "Standard"
  },
  "kind": "StorageV2",
  "properties": {
    "accessTier": "Hot"
  },
  "resources": [
    {
      "type": "blobServices/containers",
      "apiVersion": "2019-06-01",
      "name": "[parameters('containerName'))]",
      "dependsOn": [
        "[parameters('storageAccountName')]"
      ]
    }
  ]
}
]

After deployment, I can see only the Storage Account but not the Container inside it.

So, can anyone suggest me how to create Container inside Storage Account using ARM templates

Pradeep
  • 5,101
  • 14
  • 68
  • 140

1 Answers1

4

When you deployed the ARM template, there should have been an error. enter image description here

The error is because your ARM template is missing a segment of the name for the container. You'll need to include the following segment. enter image description here

Stringfellow
  • 2,788
  • 2
  • 21
  • 36
  • I want to give custom container name instead of doing `concat` – Pradeep Oct 06 '20 at 11:16
  • 1
    Using `concat` is necessary when working with child resources in order build a valid name for the resource. The concatenated 'default/' segment does not appear when accessing the container. https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/error-invalid-template#solution-2---incorrect-segment-lengths – Stringfellow Oct 06 '20 at 13:41