AzureFunBytes Episode 51 - Deploy With ARM Templates with @shankuehn
Tags: azure, cloud, iac, beginners
Published: 2021-07-15 19:12:07

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](https://cda.ms/226) and learn more about Azure.

![AzureFunBytes animation](https://res.cloudinary.com/practicaldev/image/fetch/s--Z7BxBMz1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j2xzw2g664tj31jij13t.gif)

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.  

To help me share the beauty of ARM templates, I welcomed Microsoft Senior Cloud Advocate [Shannon Kuehn](https://twitter.com/shankuehn) 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.  

{% youtube 4N174v3YnjE %}

[00:03:33 - Let's meet Shannon](https://youtu.be/4N174v3YnjE?t=213)
[00:12:26 - Introducing ARM Templates](https://youtu.be/4N174v3YnjE?t=746)
[00:18:48 - Understanding structure and syntax](https://youtu.be/4N174v3YnjE?t=1128)
[00:22:39 - Quickstart templates](https://youtu.be/4N174v3YnjE?t=1359)
[00:26:54 - Deploy to Azure button](https://youtu.be/4N174v3YnjE?t=1614)
[0:28:49 - Authoring templates with Visual Studio 2019](https://youtu.be/4N174v3YnjE?t=1729)
[00:33:48 - Templates in Visual Studio Code](https://youtu.be/4N174v3YnjE?t=2028)
[00:38:23- Exporting your template in the portal](https://youtu.be/4N174v3YnjE?t=2303)
[00:43:17 - Deploying a Virtual Machine](https://youtu.be/4N174v3YnjE?t=2597)

Our Agenda:

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](https://github.com/Azure/azure-quickstart-templates)
  2. [Azure ARM Template Reference](https://cda.ms/2f5)
  3. [Microsoft Learn Path](https://cda.ms/2f7)
  4. [ARM Template best practices](https://cda.ms/2f8)
  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?](https://cda.ms/2ff) (move to my local machine to demonstrate this with real live code)
  1. Start with a basic template format in [Visual Studio Code](https://cda.ms/2fb).
  2. Highlight what are [parameters](https://cda.ms/2fg), [variables](https://cda.ms/2fh), [functions](https://cda.ms/2fj), [resources](https://cda.ms/2fm), and [outputs](https://cda.ms/2fn).
  3. Go over [metadata](https://cda.ms/2fp) 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.

------

Learn about Azure fundamentals with me!

Live stream is normally found on Twitch, YouTube, and [LearnTV](https://cda.ms/226) at 11 AM PT / 2 PM ET Thursday. You can also find the recordings here as well:

[AzureFunBytes on Twitch](https://twitch.tv/azurefunbytes)
[AzureFunBytes on YouTube](https://aka.ms/jaygordononyoutube)
[Azure DevOps YouTube Channel](https://www.youtube.com/channel/UC-ikyViYMM69joIAv7dlMsA)
[Follow AzureFunBytes on Twitter](https://twitter.com/azurefunbytes)

Useful Docs:

[Get $200 in free Azure Credit](https://cda.ms/219)
[Microsoft Learn: Introduction to Azure fundamentals](https://cda.ms/243)
[What are ARM templates?](https://cda.ms/2f6) 
[Define resources in ARM templates](https://cda.ms/2f5) 
[Microsoft Learn: Deploy and manage resources in Azure using JSON ARM templates](https://cda.ms/2f7) 
[ARM template best practices](https://cda.ms/2f8)
[Quickstart: Create ARM templates with Visual Studio Code](https://cda.ms/2fb)
[Tutorial: Create and deploy your first ARM template](https://cda.ms/2fM)
[Quickstart: Create and deploy template spec](https://cda.ms/2fc)
[Tutorial: Utilize the ARM template reference](https://cda.ms/2fd)
[How to use Key Vault for ARM Template Deployments](https://www.shankuehn.io/post/how-to-use-keyvault-for-arm-template-deployments)