To follow this tutorial, you need:

  • An Azure account
  • The Azure CLI program
  • The Terraform CLI program

Optionally, you may want to save your work in a GitHub repository, as well.

This page describes how to set up and install the necessary applications.

Create a free Azure account

To create your free Azure account:

Set up the Azure CLI

  1. Download the Azure CLI for your operating system:

  2. In your terminal, run the following command:

    az login
    

    A browser window opens at https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize.

    Select your Microsoft account to log in.

    If a window does not open, cancel the command (Ctrl + C) and run the following command instead:

    az login --use-device-code
    

    Then follow the directions in the terminal to log in.

  3. From the table in your terminal, select your subscription.

    If you have only one subscription, press Enter.

    If you have more than one subscription, enter the number in the left-most column of your desired subscription's row and then press Enter.

If the terminal shows your tenant and subscription ID, you've successfully logged in to the Azure CLI. You may seem some announcements or warnings, as well.

azure-cli-finish

Install the Terraform CLI

  1. Go to Install Terraform.
  2. Download the Terraform package for your operating system:

  3. To confirm the installation, run the following command:

     terraform -version
    

    The command returns the version of the downloaded Terraform package.

    terraform-download-finish

Install the Terraform VS Code extensions

  1. Open VS Code and select the Extensions icon.

    terraform-vs-code-extension-icon
  2. Search for Terraform.
  3. From the search results, find the extension published by HashiCorp.
  4. Select Install.

    terraform-vs-code-extension-install

    A new window opens in VS Code.

You’ve successfully installed the Terraform extension

Updated: