- Lab
-
Libraries: If you want this lab, consider one of these libraries.
- Cloud

Using Terraform with Azure (Setting the Stage)
Welcome to the Using Terraform with Azure lab. In this lab, we will cover three objectives: 1. Log into Azure 1. Create the Terraform Configuration 1. Deploy the Configuration By the end of the lab, you'll have deployed a container group to Microsoft Azure using Terraform.

Lab Info
Table of Contents
-
Challenge
Log into Azure
In this objective, you'll use the credentials provided by the lab to log into Azure using the Azure CLI.
- Open your terminal and run the
az login
command - In the browser window that opens, enter the credentials provided by the lab
- Run
az account show
to verify you've logged in successfully
- Open your terminal and run the
-
Challenge
Create the Terraform Configuration
In this objective, you'll create a Terraform configuration that deploys a container group to Azure.
- Create new directory and files to hold your Terraform configuration.
- Add a
terraform
block requiring major version 3 of theazurerm
provider. - Add an
azurerm
provider block with theskip_provider_registration
argument set totrue
. - Add a data source to reference the existing resource group.
- Add a container group resource that uses the ACI hello world image and exposes port 80 on a public URL.
- Image reference:
mcr.microsoft.com/azuredocs/aci-helloworld
- Image reference:
- Add an output to display the FQDN of the container group.
- Initialize your working directory.
- Format and validate the code.
-
Challenge
Deploy the Configuration
In this objective, you'll deploy the Terraform configuration to Azure and verify the deployment.
- Create a
terraform.tfvars
file and populate any required variables. - Deploy the configuration to Azure.
- Visit the address shown in the output and verify the webpage loads.
- Create a
About the author
Real skill practice before real-world application
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.
Learn by doing
Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.
Follow your guide
All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.
Turn time into mastery
On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.