Prerequisites
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:
- Go to azure.microsoft.com.
-
Select Try Azure for free.
Azure sign-up prompt
Set up the Azure CLI
-
Download the Azure CLI for your operating system:
-
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.
-
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.

Install the Terraform CLI
- Go to Install Terraform.
-
Download the Terraform package for your operating system:
-
To confirm the installation, run the following command:
terraform -version
The command returns the version of the downloaded Terraform package.
Terraform version command
See the following tutorials to learn more about using Terraform:
- Get Started - Azure
- Use the Command Line Interface
- Write Terraform Configuration
- Manage Azure Services
Install the Terraform VS Code extensions
-
Open VS Code and select the Extensions icon.
VS Code sidebar - Search for Terraform.
- From the search results, find the extension published by HashiCorp.
-
Select Install.
VS Code extension marketplace A new window opens in VS Code.
You’ve successfully installed the Terraform extension.