Installing the Azure Az Module for PowerShell Core

45 minutes
  • 3 Learning Objectives

About this Hands-on Lab

The Az module in PowerShell Core is necessary for managing Azure resources. In this hands-on lab, we will show how to install the Az module and perform some basic commands for managing resources in Azure.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Log in to the VM
  1. Open a new terminal.
  2. Copy the public IP address, given to you along with this hands-on lab.
  3. In the terminal, enter ssh cloud_user@<PUBLIC_IP_OF_THE_VM>.
  4. Once logged in, enter pwsh to start the PowerShell prompt.
Install the Az PowerShell Module
  1. Install the module:

    Install-Module -Name Az -AllowClobber -Scope CurrentUser
  2. Type Y to continue installing from the PowerShell gallery.

Connect the Azure Account and Create a VM
  1. From the PowerShell prompt, enter the command Connect-AzAccount to connect to Azure.
  2. Go to https://microsoft.com/devicelogin, and enter the code provided in the terminal.
  3. Enter the username and password provided with this hands-on lab.
  4. Enter the following to create a new Azure VM:

    New-AzVM `
    -ResourceGroupName '<RESOURCE_GROUP_NAME_PROVIDED_IN_LAB>' `
    -Name 'myvm1234' `
    -Location 'westus' `
    -VirtualNetworkName '<VIRTUAL_NETWORK_NAME_PROVIDED_IN_LAB>' `
    -SubnetName 'default' `
    -SecurityGroupName '<NSG_PROVIDED_WITH_LAB>' `
    -PublicIpAddressName 'myvm1234pubip' `
    -OpenPorts 80,3389

Additional Resources

In this scenario, you must create some Azure resources, but you do not have the Az module installed yet on your Linux Machine. You are using a Linux VM with PowerShell Core installed, in which you must install the Az Module and use the Az Module to create a new VM.

In order to complete this hands-on lab, perform the following:

  • Log in to the VM that has been provided with this hands-on lab.
  • Open a PowerShell prompt with the pwsh command.
  • Install the Az module.
  • From that same PowerShell session, connect to your Azure account.
  • Once you've connected to your Azure account, create a new Azure VM.

What are Hands-on Labs

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.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?