2 Writing your first ARM template

 

This chapter covers

  • Writing your first ARM template
  • Using VS Code to write and validate templates
  • Deploying a template using the Azure portal
  • Creating a visual representation of your template

With the theory covered, it’s time to write your first ARM template. While writing ARM templates may seem like a tough job at first, you’ll get the hang of it soon enough. Experience shows that it takes most people one or two days of practice to get familiar with the syntax.

Getting started is easier when you use the right tools for the job. ARM templates are written as JSON documents, so a powerful text editor is recommended. For ARM templates specifically, Visual Studio Code (VS Code) is the best choice. VS Code is not only a powerful text editor, but there is an extension that supports writing ARM templates. This chapter will help you set up VS Code and the extension.

When writing ARM templates, you need to be at least somewhat familiar with the infrastructure you want to create. For example, in this chapter, you will deploy an Azure storage account. Storage accounts are, amongst other things, used for storing files, often referred to as binary large objects (BLOBs). In Azure, the storage account is called a resource type, of which you can create instances. When you create an instance of a storage account, that storage account is called a resource. A storage account is one of many resource types available in Microsoft Azure.

2.1 Working with JSON files

2.1.1 Installing the ARM templates extension in VS Code

2.2 Writing ARM templates in VS Code

2.2.1 Adding a resource

2.2.2 Leveraging IntelliSense in VS Code

2.3 Deploying an ARM template

2.4 Monitoring template deployments

2.5 Finding example templates

2.6 Visualizing templates

Summary