DEV Community

Cover image for Demystifying ARM Templates: Create Your First Template
Frank Boucher ☁ for Microsoft Azure

Posted on • Updated on

Demystifying ARM Templates: Create Your First Template

Now it's time to code. This session introduces the ARM Tools extension for VS Code, shows you how to create your first template from a snippet, and how to deploy it.

Azure DevOps - DevOps Lab - Video

The Azure Resource Manager (ARM) Tools for Visual Studio Code, is available from the marketplace (for free), or directly from VSCode. Click the Extensions button from the Side Bar and search for "ARM Tools".

Visual Studio extension

Now from any JSon (.json) file, the extension will automatically be active. Create a new File and save it as a JSON file (ex: firstARMTemplate.json). Start typing arm, you should see the context menu popping.

Create an ARM template

  • That will add an empty template.
  • Now type arm-storage, you should see a list of Azure resources filtered down to show only the storage. Click it and you should have now your first template done.

armStorage

Now the tools are asking you to enter a name for your resource. Enter: learningARMStorage.

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {},
    "functions": [],
    "variables": {},
    "resources": [
        {
            "name": "storageaccount1",
            "type": "Microsoft.Storage/storageAccounts",
            "apiVersion": "2019-06-01",
            "tags": {
                "displayName": "storageaccount1"
            },
            "location": "[resourceGroup().location]",
            "kind": "StorageV2",
            "sku": {
               "name": "Premium_LRS",
               "tier": "Premium"
             }
        }
    ],
    "outputs": {}
}
Enter fullscreen mode Exit fullscreen mode
  • You have now a template
  • show auto-complete stuff
  • validation in the outputs section.
  • Notice the location is using an expression. In fact it's a ARM function, we will learn more about it in the episode/ module 5.

References

Top comments (0)