The last place I left off with my deconstruction of JSON, I had deployed a basic network as the basis for my future home for some virtual machines. The next key dependency for Virtual Machine is storage. In this case, I’ll need a storage group in the same regional location (and ideally in the same resource group) as my network.
For the sake experimentation, this template example creates two different storage accounts and takes advantage of both parameters and variables to determine the location and the storage account name.
The default parameters set the storage account as “wrongnamestor” and the location in the East US. These settings will apply to the first instance of the storage account resource. In the variable section, the storage account name is set as “labweststor2” with a location in the West US region.
Because I would probably like both my storage accounts to be in the same region with similar naming, I’ve also created the additional parameters file named “azuredeploy.parameters.json”. This short file will override the default parameters in the deployment template and set the desired storage account name of “labweststor1” in the West US.
I’ll deploy this template using the following PowerShell:
This line of PowerShell is exactly the same as the line I used to deploy the networking template. The only thing that would need be changed is the actual details of the file location.
As a bonus, the default behavior of Azure Resource Manager deployments is incremental. Since I’m deploying to the same Resource Group that was created with my networking template, the result will be the addition of the two storage accounts to the resource group that contains the network.
If I wanted the template to remove anything not specified, I would have to add the “-mode complete” switch. Template deployments in the portal only run in incremental mode.
Now that I know my storage template is working as expected, I’ll integrate those resources and parameters into one template as I build out the complete deployment.