Need to create an ARM template for azure blob storage and adding a container in it. Can anybody enlighten me on this. Thanks in advance.
            Asked
            
        
        
            Active
            
        
            Viewed 2,844 times
        
    -2
            
            
        - 
                    in my previous answer I've given you the link to the repo containing the template that you need, anything wrong with that? – 4c74356b41 Mar 01 '19 at 10:53
- 
                    In that answer I'm not able to understand How's it making a container or where it defined that storage account is created. – user11099777 Mar 01 '19 at 10:56
- 
                    you talking about powershell? whats not clear there? – 4c74356b41 Mar 01 '19 at 11:10
- 
                    You have send me a github link for the arm template, that one I'm not able to understand that – user11099777 Mar 01 '19 at 11:13
- 
                    if everything is fine with that powershell, you should accept that answer, as for the arm template, [here's the link](https://github.com/Azure/azure-quickstart-templates/blob/master/101-storage-blob-container/azuredeploy.json) to the template that does what you ask for exactly – 4c74356b41 Mar 01 '19 at 11:15
1 Answers
1
            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.
 
    
    
        SumanthMarigowda-MSFT
        
- 1,920
- 9
- 14
 
    