Hands-On LabIntermediate

Deploy Linux VM with Networking using Azure CLI Script

Automate Azure infrastructure deployment with Bash scripting. Create a reusable script to deploy a Linux VM with networking using Azure CLI commands.

60 minEstimated time
3Guided steps
AutoVerification
IsolatedSandbox
Deploy Linux VM with Networking using Azure CLI Script

Lab overview

Azure CLI is a command-line tool for managing Azure resources on Windows, macOS, and Linux. Combined with Bash scripting, it lets you automate infrastructure deployments so the same commands run the same way every time. Teams use this pattern to reduce manual errors and to practice Infrastructure as Code without jumping straight to ARM or Bicep.

A Bash script packages those CLI commands into one file: argument checks, resource lookups with JMESPath, and a Linux VM with VNet, subnet, NSG, public IP, and NIC created in a single run.

In this lab, you will write deploy.sh, run it against your lab resource group, and SSH into the Linux VM it creates.

Objectives

By completing this intermediate lab, you will be able to:

  • Build a reusable Bash script that deploys Azure resources with Azure CLI
  • Validate script arguments and test that a resource group exists before deploying
  • Capture Azure CLI output with command substitution and JMESPath queries
  • Deploy a Linux VM with VNet, subnet, NSG, public IP, and NIC
  • Configure SSH key authentication for the VM

Who is this lab for?

This lab is designed for:

  • Cloud Engineers who need to automate Azure deployments with scripting
  • DevOps Engineers looking to practice Infrastructure as Code with Azure CLI
  • System Administrators transitioning to cloud-based automation

You should already be comfortable with a Bash terminal and with signing in through Azure CLI.

Verified against your live environment

An automated validation engine inspects your actual resources and configurations as you work. Completion means the task was performed — not multiple choice, real-world proficiency.

[CHECK] validation_activelive
Inspecting deployed resources...
Verifying configuration state...
✓ Step requirements satisfied

More labs like this

Related reading

PremiumIncluded in Premium
Duration
60 min
Steps
3

Environment

Browser Code IDELive Cloud Environment

Every lab includes

  • Real environment, pre-credentialed
  • Automated checks on every step
  • Isolated sandbox, auto cleanup
  • AI-recommended next steps

Lab curriculum

  1. 01

    Logging into Azure CLI

  2. 02

    Writing a Bash Script to Deploy a Linux VM

    1 automated check

  3. 03

    Running the Linux VM Script and Connecting with SSH

    1 automated check

Skills validated

Azure Virtual MachinesAzure CLIVirtual Networks

Not the lab you were looking for?

Browse 150+ hands-on labs across AWS, Azure, Kubernetes, Docker, and cloud security.

Explore the catalog