Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Azure icon
Labs

Deploying an Azure VM with Terraform

Deploying VMs is the primary target for almost all attempts at automation. Terraform provides a much more human-readable syntax than that of an ARM template, and allows for the creation of any prerequisites you may want, or need without having to jump around multiple portal screens. In this hands-on lab, we will take what we've done in the previous labs and add in the creation of a NIC and a marketplace Ubuntu VM. Additionally, we will create a Boot Diagnostics storage account to support the use of the serial console, providing a quick way to test the VM's deployment.

Azure icon
Labs

Path Info

Level
Clock icon Beginner
Duration
Clock icon 30m
Published
Clock icon Jan 31, 2020

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Set Up the Command Line Interface (CLI)

    1. Open the CLI.
    2. Select Bash at the prompt.
    3. Click Show Advanced Settings. Both the Resource Group and Storage Account should be pre-selected with the lab generated values.
    4. In the File share section, choose the Create new radio button and enter console.
    5. Click the Attach Storage button.
    6. Once the command prompt is initialized, proceed to Task 2.
  2. Challenge

    Deploy a Ubuntu VM

    1. Use the code block found in the Additional Information and Resources section to create a test.tf file and upload it to the CLI.
    2. In the (resource "azurerm_storage_account" "lab") declaration, you'll need to edit the resource_group_name value with the name generated by the lab. The "provider" statement has been added to the code, so you won't need to create a main.tf file to deploy the storage account.
    3. Once the file has been uploaded, run terraform init.
    4. Run terraform plan and review the output to confirm that Terraform will create the desired resource. Green plus signs will indicate the resources that need to be added.
    5. Run terraform apply, answering yes to the prompt to continue.
    6. Once Terraform completes the deployment, check the Azure Portal to confirm.

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

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.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans