Use Arrays in Windows PowerShell
In this virtual IT Pro Challenge, learners use an Azure command-line interface (CLI) to manage a Linux virtual machine (VM) provisioned through Azure. Lab exercises teach learners on System Administrators, Network Analysts, and Cloud Engineers career paths to use CLI commands to manage Linux VM users and disks effectively.
In this 45-minute IT Pro Challenge, you will install a Microsoft Azure Command Line Interface (CLI), on your local machine, to remotely manage an Ubuntu Linux virtual machine (VM), and confirm on the Linux VM successful execution. You will want to install PuTTY, a secure connection application to Linux, regardless of the Operating System (OS) on your local machine. If you plan on taking the lab on a mac operating system (OS), you will need to have Homebrew installed to get the Azure CLI.
This lab targets beginning learners who have had some experience executing code through a command-line interface and have connected securely to a remote Linux machine. Lab participants should plan on a full forty-five minute to run through the lab, in one sitting. While users will not be able to return to the lab mid-way, they can launch the lab more than once. Learners will receive a notification when the Azure's Linux VM disk, Linux1, finishes starting.
Learners interested in any Information Technology (IT) career will benefit greatly from doing this virtual lab. You will know how to construct and run commands to handle and update a remote Linux machine. Getting comfortable with Azure's CLI will give you the skills to quickly manipulate Azure services and write automated scripts. You will practice creating and managing VM user accounts and verifying the VM's integrity. You will also solidify skills in Linux to confirm the completion of lab exercises.
Understanding the Scenario:
You are a system administrator for a company that uses Linux virtual machines in Azure. You manage the virtual machines using the command line. First, you will download and install the Microsoft Azure CLI (command-line interface) tools on your local on-premises computer for remote Linux virtual machine management in the Microsoft Azure cloud. Next, you will use the Azure CLI to manage Azure virtual machine user accounts. Finally, you will use the Azure CLI to verify an Azure Linux virtual machine disk's integrity.
Download and Install the Microsoft Azure CLI:
In this section, you sign into the Azure VM set-up by the lab. Then you download the Azure CLI from the Microsoft Website. Be sure to verify you have the right installer for your local's machine's operating system. Finally, you confirm that Azure CLI has successfully loaded onto your local machine.
Use the Azure CLI to View Virtual Machines:
This lab exercise has two parts. First, you authenticate Azure by using the 'az login' command. Second, you find VM properties using Azure's CLI. You view the name of your Linux machine, 'Linux1'.
Use the Azure CLI to Manage Virtual Machine User Accounts:
You make a user account on the 'Linux1' VM using the 'az vm user' update command. You can enter this same code to reset a Linux account's password. To remove a Linux user account from the Azure cloud, you type 'az vm user delete' in the Azure CLI. Be sure to open up a second CLI window for the next exercise, one for running commands through Azure CLI and the second to confirm success in the Linux machine.
Verify the Integrity of an Azure Linux Virtual Machine Disk:
First, you use the Azure CLI to list the Linux OS disk name on the Linux1 VM. Then you create a script called check_disk and save it with a JSON extension. The instructions tell you what content to put in this file. Finally, you run the disk check through the Azure CLI and look on the Linux1 VM that this integrity check succeeded.
By lab completion, you will know how to manipulate Azure CLI, managing a Linux machine. You will master:
- Installing the Microsoft Azure CLI onto your local computer.
- Viewing virtual machine information through Azure CLI.
- Managing Linux VM user accounts through Azure CLI.
- Verifying VM disk integrity through Azure CLI.
You will have obtained the basics in customizing and creating automation scripts using Azure CLI.