Lab 03c - Manage Azure Resources by Using Azure PowerShell
Lab 03c - Manage Azure Resources by Using Azure PowerShell
Azure PowerShell
Student lab manual
Lab scenario
Now that you explored the basic Azure administration capabilities associated with
provisioning resources and organizing them based on resource groups by using the Azure
portal and Azure Resource Manager templates, you need to carry out the equivalent task by
using Azure PowerShell. To avoid installing Azure PowerShell modules, you will leverage
PowerShell environment available in Azure Cloud Shell.
Objectives
In this lab, you will:
Instructions
Exercise 1
1. In the portal, open the Azure Cloud Shell by clicking on the icon in the top right of
the Azure Portal.
2. If prompted to select either Bash or PowerShell, select PowerShell.
Note: If this is the first time you are starting Cloud Shell and you are
presented with the You have no storage mounted message, select the
subscription you are using in this lab, and click Create storage.
3. If prompted, click Create storage, and wait until the Azure Cloud Shell pane is
displayed.
4. Ensure PowerShell appears in the drop-down menu in the upper-left corner of the
Cloud Shell pane.
Task 2: Create a resource group and an Azure managed disk by using Azure
PowerShell
In this task, you will create a resource group and an Azure managed disk by using Azure
PowerShell session within Cloud Shell
1. To create a resource group in the same Azure region as the az104-03b-rg1 resource
group you created in the previous lab, from the PowerShell session within Cloud
Shell, run the following:
2. $location = (Get-AzResourceGroup -Name az104-03b-rg1).Location
3.
4. $rgName = 'az104-03c-rg1'
5.
New-AzResourceGroup -Name $rgName -Location $location
6. To retrieve properties of the newly created resource group, run the following:
7. To create a new managed disk with the same characteristics as those you created in
the previous labs of this module, run the following:
8. $diskConfig = New-AzDiskConfig `
9. -Location $location `
10. -CreateOption Empty `
11. -DiskSizeGB 32 `
12. -Sku Standard_LRS
13.
14. $diskName = 'az104-03c-disk1'
15.
16. New-AzDisk `
17. -ResourceGroupName $rgName `
18. -DiskName $diskName `
-Disk $diskConfig
19. To retrieve properties of the newly created disk, run the following:
In this task, you will managing configuration of the Azure managed disk by using Azure
PowerShell session within Cloud Shell.
1. To increase the size of the Azure managed disk to 64 GB, from the PowerShell
session within Cloud Shell, run the following:
Clean up resources
Note: Do not delete resources you deployed in this lab. You will reference them in the next
lab of this module.
Review