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

Creating a Linux VM using Azure CLI

In this hands-on lab, we play the part of a Cloud Engineer who is tasked with using the Azure CLI to provision a Linux-based virtual machine running Nginx. This VM is intended for our web development team's newest project. In this hands-on lab, we cover Azure CLI syntax, Azure CLI help/parameters, and Network Security Groups.

Azure icon
Labs

Path Info

Level
Clock icon Beginner
Duration
Clock icon 30m
Published
Clock icon Aug 21, 2020

Contact sales

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

Table of Contents

  1. Challenge

    Create a Virtual Machine

    Create a Virtual Machine Using Azure CLI and the Following Settings:

    • Resource Group: (Existing resource group)
    • Name: LabVM
    • Image: UbuntuLTS
    • Admin Username: azureuser
    • Authentication Method: Generate SSH Keys

    Note: The resource group has already been created for you.

    1. Login to the Azure Portal using the credentials provided in this hands-on lab.
    2. Navigate to the Cloud Shell, using the >_ icon in the toolbar on the top-right side of the screen.
    3. Ensure you are using PowerShell for Azure Cloud Shell.
    4. Click Show advanced settings.
    5. Use the existing Resource Group.
    6. Choose the Cloud Shell Region that matches the location of your lab provided Resource Group.
    7. Under the Storage account section select Use existing.
    8. Under the File share section select Create new and type in cloudshell.
    9. Select Attach storage.
    10. Once Cloud Shell has opened, identify the existing Resource Group using az group list.
    11. Copy the value of the name: field. This is the Resource Group name.
    12. Set the Resource Group variable by typing $rg = "<insert-resource-group-name>" and press Enter.
    13. Set the virtual machine's name by creating its variable with $vm = "kaldiVM".
    14. Deploy a virtual machine (VM) by typing: az vm create -g $rg -n $vm --image "UbuntuLTS" --admin-username "azureuser" --generate-ssh-keys
    15. After the VM is created copy the publicIPAddress for later use.
  2. Challenge

    Open Port 80 On the VM for Web Traffic

    Open Port 80 on VM using Azure CLI

    1. Open port 80 on the VM we created: az vm open-port -g $rg -n $vm --port 80
    2. Install Nginx by first logging into the server. Don't forget to accept the fingerprint: ssh azureuser@<PubliIP.OF.VM>
    3. Update the Ubuntu VM: sudo apt update -y
    4. Install Ngnix: sudo apt-get install nginx -y
    5. Navigate to the web browser and paste in the VM's IP address. If successful, the default "Welcome to Nginix!" page appears.

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