DEV Community

Cover image for AzureFunBytes Reminder - Deploy With ARM Templates with @shankuehn - 7/15/2021
Jay Gordon for Microsoft Azure

Posted on

AzureFunBytes Reminder - Deploy With ARM Templates with @shankuehn - 7/15/2021

AzureFunBytes is a weekly opportunity to learn more about the fundamentals and foundations that make up Azure. It's a chance for me to understand more about what people across the Azure organization do and how they do it. Every week we get together at 11 AM Pacific on Microsoft LearnTV and learn more about Azure.

When: July 15, 2021 11 AM Pacific / 2 PM Eastern
Where: Microsoft LearnTV

AzureFunBytes animation

When deploying to the cloud you need to ensure that you're doing so with reliability and repeatability. For this, many turn to Infrastructure as Code (IaC) to help solidify a plan with declarative instructions on what, when, and where to build. If you're looking to deploy to Azure using IaC, you can turn to Azure's native method, Azure Resource Manager (ARM) templates. ARM is a consistent management layer also known as a control plane. You can use Azure tools, APIs, and SDKs to send requests to ARM to create, modify, and destroy your resources.

ARM templates are a JSON file that helps you define what exactly you need to do in your Azure deployment. You do not need to know a specific programming language in order to use this declarative syntax. Specify your needs in this template and send it to ARM using native tools such az Azure CLI or the portal.

From the Azure docs on ARM templates:

Within your template, you can write template expressions that extend the capabilities of JSON. These expressions make use of the functions provided by Resource Manager.

The template has the following sections:

  • Parameters - Provide values during deployment that allow the same template to be used with different environments.
  • Variables - Define values that are reused in your templates. They can be constructed from parameter values.
  • User-defined functions - Create customized functions that simplify your template.
  • Resources - Specify the resources to deploy.
  • Outputs - Return values from the deployed resources.

To help me share the beauty of ARM templates, I welcome Microsoft Senior Cloud Advocate Shannon Kuehn to the show. Shannon comes with years of experience in deploying using a variety of IaC tools. A self-described tinkerer, Shannon has worked with technical mentors and colleagues who have helped her develop proficiencies in infrastructure. We will look at the ARM template structure, deploy some resources, and of course take your questions. Don't miss out on this opportunity to learn more about deploying your Azure applications with repeatability and reliability.

Shannon has a big agenda planned:

  1. Intro/background

  2. Declarative code vs. imperative.

    1. Talk terms and stress the importance of idempotency with cloud scale deployments of infrastructure.
    2. ARM is based upon JSON, which is the response you get from calling an Azure REST API directly.
    3. Highlight the difference between ARM Templates and Bicep (i.e. ARM came first.
    4. ARM Templates encompass the full gambit of deployments: simple (single storage account, 1 VM), intermediate (2 VMs in the same VNet in an Availability Set), advanced (VM deployment using DSC/Custom Script Extension, nested templates)
  3. How to get started? Where to go?

    1. Azure Quickstart GitHub Repo
    2. Azure ARM Template Reference
    3. Microsoft Learn Path
    4. ARM Template best practices
    5. A few books, courses, and publications also have helped me out in making sense of things
    6. PLUS – Maybe even finding a dev who can help you understand concepts if you get a lot of errors when deploying and how to make sense of something if you’re stuck.
  4. What makes up an ARM template? (move to my local machine to demonstrate this with real live code)

    1. Start with a basic template format in Visual Studio Code.
    2. Highlight what are parameters, variables, functions, resources, and outputs.
    3. Go over metadata and comments to help ARM templates make sense to someone brand new.
    4. Go over the reasoning behind using all of these components, indicating the only required component is the resource section (but every section has a function).
    5. Talk about API versions/schema and why that’s relevant (i.e. Private Link is a newer resource, so you’d pick a newer API when building out your ARM templates)
  5. Start with a vNet. Deploy the vNet with a PowerShell script that I’ll highlight.

    1. Move to the portal and showcase where it lives.
    2. Add a VM to the same vNet. Deploy with the same PowerShell script. Highlight that the template didn’t deploy 2 vNets…only 1…and that really showcases the idempotency of declarative syntax vs. imperative syntax.
    3. Add a storage account and configure it as a file share that you can mount from within the VM. Part of this exercise will be to RDP into the VM and showing how to mount the file share.

So join us this week and let's get building!

Learn about Azure fundamentals with me!

Live stream is normally found on Twitch, YouTube, and LearnTV at 11 AM PT / 2 PM ET Thursday. You can also find the recordings here as well:

AzureFunBytes on Twitch
AzureFunBytes on YouTube
Azure DevOps YouTube Channel
Follow AzureFunBytes on Twitter

Useful Docs:

Get $200 in free Azure Credit
Microsoft Learn: Introduction to Azure fundamentals
What are ARM templates?
Define resources in ARM templates
Microsoft Learn: Deploy and manage resources in Azure using JSON ARM templates
ARM template best practices
Quickstart: Create ARM templates with Visual Studio Code
Quickstart: Create and deploy template spec
Tutorial: Utilize the ARM template reference

Top comments (0)