This tutorial uses infrastructure as code concepts to create resources in an Azure cloud environment.

Before you can follow this tutorial, you must:

  • Create an Azure account
  • Install the Azure command-line interface (CLI)
  • Install the Terraform command-line interface (CLI)

Optionally, you can save your work in a GitHub repository.

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

Create a free Azure account

To create your free Azure account:

  1. Go to azure.microsoft.com.
  2. Select Try Azure for free.
    azure-account-create-free
    Azure sign-up prompt

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 see some announcements or warnings, as well.

azure-cli-finish
Azure CLI login confirmation

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
    Terraform version command

See the following tutorials to learn more about using Terraform:

Install the Terraform VS Code extensions

  1. Open VS Code and select the Extensions icon.

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

    terraform-vs-code-extension-install
    VS Code extension marketplace

    A new window opens in VS Code.

You’ve successfully installed the Terraform extension.

Updated: