Create an Azure Storage Account and Blob Container on Azure
How to create a 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"
}
}
Adding JSON to your ARM template will make sure a new storage account is created with the specified settings and parameters. How to create ARM templates.
Now for adding a container to this storage account! To do so, you need to add a new resource of the type blobServices/containers
to this template.
{
"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"
}
}]
}
Deploying this will make sure a container is created with the name NameContainer
inside the storage account.
{
"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')]"
]
}
]
}
Let us know if the above helps or you need further assistance on this issue.
solved How to create an azure blob storage using Arm template?