- Authoring and deployment of ARM templates can be hard:
- Become very complex in a short amount of time.
- Difficult to ensure that Microsoft best practices for Azure infrastructure are reflected in every template authored by your team.
- Development of your templates follows a pattern:
- E.g.:
- JSON object for a virtual network
- JSON object for virtual machines that are deployed into the virtual network.
- JSON object for a network security group to secure the virtual network.
- JSON object for a load balancer to distribute incoming requests to the virtual machines
- E.g.:
- Problem:
- Great deal of knowledge about Azure Resource Manager and the resources themselves.
- Difficulty maintaining your templates because any modification can lead to unforeseen issues.
- Command line tool and set of ARM templates.
- Reflect best practices as prescribed by the Patterns & Practices team at Microsoft.
- Designed to simplify deployment of Azure resources.
- Flow:
- Specify settings for Azure resources using the Building Blocks JSON schema
- You can either specify your resources settings in one large file or several small files.
- Supports: • Virtual Networks • Virtual Machines (including load balancers) • Virtual Machine Extensions • Route Tables • Network Security Groups • Virtual Network Gateways • Virtual Network Connection
- Command line tool merges these settings with best practice defaults (from GitHub templates) to produce a set of parameter files
- The command line tool deploys these parameter files using a set of pre-built Azure Resource Manager templates
- Specify settings for Azure resources using the Building Blocks JSON schema
-
Install
azbb*
command line tool and the Azure CLI. -
Create building blocks
- Create a JSON file with a
buildingBlocks
parameter containing an array of resources that you wish to deploy.- Each resource within that JSON array can have certain options configured.
- E.g. Virtual Network resource =>
addressPrefix_
,subnets_
andname
. - Any options you do not specify are set using the default options specified in the building blocks repository.
- E.g. deploying a Virtual Network includes following properties:
type
:identify the type of building block. E.g. VirtualNetwork.name
: Unique name of the resourceaddressPrefixes
: Array of address ranges in CIDR notation.- E.g.:
"addressPrefixes": [ "10.0.0.0/16", "11.0.0.0/16" ]
- E.g.:
subnets
:ian array—we can specify up to 1,000 subnets for each VNet.
- Create a JSON file with a
-
Create a settings file
-
Run the azbb command line tool to parse your settings and combine it with the default settings from the building blocks repository
- The azbb command line tool will output an ARM template parameters file,
-
Empty settings file:
{ "$schema": "https://raw.githubusercontent.com/mspnp/template-building-blocks/master/schemas/buildingBlocks.json", "contentVersion": "1.0.0.0", "parameters" : { "buildingBlocks": { "value": [ {} ] } } }
-
E.g. deploying a Virtual Network
{ "$schema": "https://raw.githubusercontent.com/mspnp/template-building-blocks/master/schemas/buildingBlocks.json", "contentVersion": "1.0.0.0", "parameters": { "buildingBlocks": { "value": [ { "type": "VirtualNetwork", "settings": [ { "name": "msft-hub-vnet", "addressPrefixes": [ "10.0.0.0/16" ], "subnets": [ { "name": "firewall", "addressPrefix": "10.0.1.0/24" } ] } ] } ] } } }
-
-
Deploy
- azbb tool will use the Azure CLI (version 2.0) to deploy the master ARM template from the building blocks repository using the parameters file that was generated.
- The Azure deployment will create a collection of resources within an Azure Resource Group.
- It'll have historical deployment information
- You can go back and view the template and parameters used by the building blocks command line tool to deploy your resources.
- It'll have historical deployment information
- The Azure deployment will create a collection of resources within an Azure Resource Group.
- Command:
azbb -g <new or existing resource group> -s <subscription ID> -l <region> -p <path to your settings file> --deploy
- azbb tool will use the Azure CLI (version 2.0) to deploy the master ARM template from the building blocks repository using the parameters file that was generated.