Windows Azure Platform Family of articles Catalog
Azure ARM (1) Overview
Azure ARM (2) Overview
Service types supported by Azure arm (3) arm
Azure Arm (4) starts creating an arm Resource group and creating a storage account
In the previous section, I described how to export a template from an existing Azure Resource group.
Next, we'll cover azure Template in general.
1. First, we open a text editor and create a JSON file named Azuredeploy.json
Then copy the following:
{ "$schema":"http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", "contentversion":"1.0.0.0", "Parameters": { }, "variables": { }, "Resources": [ ], "outputs": { } }
The above content is a standard schema for azure template.
2. Then we add the following to the resources node:
"Resources": [ { "type":"microsoft.storage/storageaccounts", "name":"[Parameters (' Storageaccountname ')]", "apiversion":"2015-06-15", " Location":"[ResourceGroup (). Location]", "Properties": { "AccountType":"Standard_lrs" } }]
What is described here is that, in Azure Template, you need to add a resource:
(1) Type of Azure Storage account
(2) The name of this storage account, obtained from the parameters node
(3) Apiversion, we use the above parameters
(4) Location value, we and Azure Resource group in the same data center
(5) The properties of this storage account are the standard local redundancy (STANDARD_LRS), the redundant Storage
3. Then we add the following to the parameters node:
"Parameters" : { "Storageaccountname": { "type":"string", "metadata": { "Description":"Storage Account Name" } }}
Here's parameters, which defines the Azure Storage account Name. The value is assigned to the name of the resources node above.
4. Our final generated Azuredeploy.json file reads as follows:
{ "$schema":"https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", "contentversion":"1.0.0.0", "Parameters" : { "Storageaccountname": { "type":"string", "metadata": { "Description":"Storage Account Name" } } }, "Resources": [ { "type":"microsoft.storage/storageaccounts", "name":"[Parameters (' Storageaccountname ')]", "apiversion":"2015-06-15", " Location":"[ResourceGroup (). Location]", "Properties": { "AccountType":"Standard_lrs" } } ]}
5. We need to set the Parameters.json, which sets the name of the storage account. Note must be lowercase
{ "$schema":"http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", "contentversion":"1.0.0.0", "Parameters": { "Storageaccountname": { "value":"Leizhangstorage1" } }}
6. We download and run Azure PowerShell and run the following command:
#Login to Azure China CloudWrite-host"Logging in ..."; ADD-azurermaccount-environmentname Azurechinacloud;#Choose your Azure China subscription IDSelect-azurermsubscription-subscriptionid"[Yoursubscriptionid]"#Create a new resource group in China EastNew-azurermresourcegroup-name testresourcegroup-location"China East"#the following Azuredeploy.json and Parameters.json both need to set local pathsNew-azurermresourcegroupdeployment-name Exampledeployment-resourcegroupname Exampleresourcegroup-templatefile Azuredeploy.json-parametersfilepath Parameters.json
After Azure PowerShell was executed, we created a new azure Resource Group named Testresourcegroup
Under this resource group, create a new storage account called Leizhangstorage1.
Reference:https://azure.microsoft.com/en-us/documentation/articles/resource-manager-template-walkthrough/
Brief introduction to Azure Arm (6) Azure Arm (5) Arm template