At this workshop I will share some of my experience and tips & tricks on how I use ARM templates to implement complex infrastructure. You will learn how to use template functions to simplify multi-environment configuration, how to structure your ARM templates so it’s easy to work with them.
ARM template is not 100% user friendly, especially at the begging. I hope that after that workshop you will learn some of the tips and tricks that will help you to be calm and cool when working with ARM.
Workshop will consists of some theoretical part (very little) and labs. We will start with creating resource groups and azure portal dashboard. Then we will implement simple infrastructure component that consists of 2 network security groups and one private virtual network with 2 subnets. And all remaining labs will be a set of refactoring tasks that will help us to improve out ARM templates and make them easy to maintain, update and introduce new environments. The reason I choose nsg and vnet as resources for the labs is because it takes very little time to provision them and since we will do a lot of refactoring, we will need to re-deploy them frequently.
If you stack with implementing ARM template either because you are not familiar with the resources we will use during the workshop or because it's not that obvious from the documentation reference what property or parameter to use, feel free to implement that is described at the lab from the portal and then just export ARM template and see how it should actually be implemented. You can find Export template option at the right side menu.
This is in fact the fastest way to learn how to implement ARM template, especially for complex resources cush as VM, ApplicationGateways, APIM etc...
Alternative option to learn ARM templates is to check the Azure Quickstart Templates . Just search for the resource you want to implement and most likely you will find it there.
For our workshop these 2 are very much relevant:
The following naming convention will be used during our workshop(s).
Of course you need an laptop. OS installed at this laptop doesn't really matter. The tools we will use work cross platform. I will be using Windows 10 with ubuntu (WSL) as a shell.
Download and install Microsoft Teams
Please download and install VS Code. It's available for all platforms. Download Visual Studio Code
Install plugin from marketplace
If you don't have an Azure account, please create one before the workshop. Create your Azure free account
Download and install latest version of az cli from this link
Install the Azure CLI
Open your terminal (bash, cmd or powershell) and login to your azure account by running this command
az loginYou will be redirected to the browser where you will need to login with your azure account. Sometimes, you need to manually copy code and enter it at this page https://microsoft.com/devicelogin. Just follow the instructions.
$ az login
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code DMBKTZBJL to authenticate.Next (and this step is optional), you need to set your active subscription. To get list of available subscriptions, use this command
az account list -o tableNote, The -o table or --output table parameter switches the output to a more concise human-readable format.
To set subscription use this command. You can use both subscription id or subscription name as value for --subscription argument.
az account set --subscription xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxor
az account set --subscription subscription_nameTo check what is the current active subscription, use this command
az account show- What is Azure Resource Manager?
- Azure Resource Manager templates overview
- Understand the structure and syntax of Azure Resource Manager templates
- Parameters in Azure Resource Manager templates
- Create Resource Manager parameter file
- Variables in Azure Resource Manager template
- Outputs in Azure Resource Manager template
- User-defined functions in Azure Resource Manager template
- Tutorial: Create and deploy your first Azure Resource Manager template
- ARM template functions
- ARM template REST
- Network Security Group template reference
- Virtual networks template reference
- Using linked and nested templates when deploying Azure resources