Azure Resource Manager JSON Template announcements

Something that was announced recently at Microsoft Build 2017 in the US was all the new features released part of Azure Resource Manager deployment using JSON templates.

  • Property Iteration – copying of properties within resources
  • Resource Iteration – parallel or serial copying of resources in CopySet constructs
  • Cross Resource Group Deployment
  • Conditions

The video of the announcement is at the very bottom. However the one that took my fancy and one that was asked about by a recent customer was resource iteration and using arrays to create multiple copies of a resource in Azure using parallel copies.

The online documentation covers it in detail – Deploy multiple instances of a resource or property in Azure Resource Manager templates. But directly below is a slide from my recent customer presentation that covers the outline of the copy construct, then further underneath is my sample JSON code which deploys Azure Service Bus using an array and parallel copies to deploy service bus across to 3 regions at once.

I also include a screenshot to what it looks like in Azure after deployment has taken place.

You can find the rest of the sample scripts here – https://github.com/rjmax/Build2017

AzurePolicy and JSON

ParallelCopies.jpg


{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"SBname": {
"type": "string"
},
"location": {
"type": "array",
"defaultValue": [
"AustraliaEast",
"AustraliaSouthEast",
"SouthEastAsia"
]
},
"skuTier": {
"type": "string",
"defaultValue": "Basic",
"allowedValues": [
"Basic",
"Standard",
"Premium"
]
},
"skuCapacity": {
"type": "int",
"defaultValue": 1
}
},
"resources": [
{
"apiVersion": "2017-04-01",
"name": "[concat('bus', parameters('location')[copyIndex()])]",
"location": "[parameters('location')[copyIndex()]]",
"type": "Microsoft.ServiceBus/namespaces",
"tags": {
"displayName": "Service Bus"
},
"copy": {
"name": "myCopySet",
"count": "[length(parameters('location'))]",
"mode": "parallel"
},
"sku": {
"name": "[parameters('skuTier')]",
"tier": "[parameters('skuTier')]",
"capacity": "[parameters('skuCapacity')]"
}
}
]
}

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s