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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With