Objectives
In this article, you will:
- 1: Start a PowerShell session in Azure Cloud Shell
- 2: Create a resource group and an Azure managed disk by using Azure PowerShell
- 3: Configure the managed disk by using Azure PowerShell
1: Start a PowerShell session in Azure Cloud Shell
we will open a PowerShell session in Cloud Shell.
In the portal, open the Azure Cloud Shell by clicking on the icon in the top right of the Azure Portal.
If prompted to select either Bash or PowerShell, select PowerShell.
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.
If prompted, click Create storage, and wait until the Azure Cloud Shell pane is displayed.
Ensure PowerShell appears in the drop-down menu in the upper-left corner of the Cloud Shell pane.
2: Create a resource group and an Azure managed disk by using Azure PowerShell
we will create a resource group and an Azure managed disk by using Azure PowerShell session within Cloud Shell
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:
powershell$location = (Get-AzResourceGroup -Name az104-03b-rg1).Location $rgName = 'az104-03c-rg1' New-AzResourceGroup -Name $rgName -Location $location
To retrieve properties of the newly created resource group, run the following:
powershellGet-AzResourceGroup -Name $rgName
To create a new managed disk with the same characteristics as those you created in the previous labs of this module, run the following:
powershell$diskConfig = New-AzDiskConfig ` -Location $location ` -CreateOption Empty ` -DiskSizeGB 32 ` -Sku Standard_LRS $diskName = 'az104-03c-disk1' New-AzDisk ` -ResourceGroupName $rgName ` -DiskName $diskName ` -Disk $diskConfig
To retrieve properties of the newly created disk, run the following:
powershellGet-AzDisk -ResourceGroupName $rgName -Name $diskName
3: Configure the managed disk by using Azure PowerShell
we will managing configuration of the Azure managed disk by using Azure PowerShell session within Cloud Shell.
To increase the size of the Azure managed disk to 64 GB, from the PowerShell session within Cloud Shell, run the following:
powershellNew-AzDiskUpdateConfig -DiskSizeGB 64 | Update-AzDisk -ResourceGroupName $rgName -DiskName $diskName
To verify that the change took effect, run the following:
powershellGet-AzDisk -ResourceGroupName $rgName -Name $diskName
To verify the current SKU as Standard_LRS, run the following:
powershell(Get-AzDisk -ResourceGroupName $rgName -Name $diskName).Sku
To change the disk performance SKU to Premium_LRS, from the PowerShell session within Cloud Shell, run the following:
powershellNew-AzDiskUpdateConfig -Sku Premium_LRS | Update-AzDisk -ResourceGroupName $rgName -DiskName $diskName
To verify that the change took effect, run the following:
powershell(Get-AzDisk -ResourceGroupName $rgName -Name $diskName).Sku
Subscribe by Email
Follow Updates Articles from This Blog via Email
No Comments