Quantcast
Channel: Cloud Training Program
Viewing all articles
Browse latest Browse all 1901

Azure Managed Disks| Create Azure Manage Disk by Using Azure Power Shell

$
0
0

In this blog, we are going to discuss the Azure Managed Disks, Staring Power Shell Session In Azure Cloud Shell.

Topics we’ll cover

Azure managed disks

Azure-managed disks are block-level storage volumes that are managed by Azure and used with Azure Virtual Machines. Managed disks are like a physical disk in an on-premises server but, virtualized. With managed disks, all you have to do is specify the disk size, and the disk type, and provision the disk. Once you provision the disk, Azure handles the rest.

The available types of disks are ultra-disks, premium solid-state drives (SSD), standard SSDs, and standard hard disk drives (HDD). The Azure Cloud Shell is a free interactive shell that you can use to run the steps in this article. It has common Azure tools preinstalled and configured to use with your account.

Start a Power Shell Session In Azure Cloud Shell

In this, you will open a Power Shell session in Cloud Shell.

1. Sign in to the Azure portal.

2. Select Cloud Shell from the top navigation bar of the Azure portal, if prompted to select.
either Bash or Power Shell, select Power Shell.

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.azureportal

Create A Resource Group And An Azure Managed Disk By Using Azure Power Shell

In this section, you will create a resource group and an Azure-managed disk by using the Azure Power Shell session within Cloud Shell.

1. Now, enter the following Power Shell script to create a resource group. 

$location = ‘East US’
$rgName = 'AZ-AG-TEST'
New-AzResourceGroup -Name $rgName -Location $location

powershell2. To retrieve properties of the newly created resource group, run the following:

Get-AzResourceGroup -Name $rgName

powershell

3. To create a new managed disk, run the following:

$diskConfig = New-AzDiskConfig `
-Location $location `
-CreateOption Empty `
-DiskSizeGB 32 `
-Sku Standard_LRS
$diskName = 'az104-disk1'
New-AzDisk `
-ResourceGroupName $rgName `
-DiskName $diskName `
-Disk $diskConfig

powershell4. To retrieve properties of the newly created disk, run the following:

Get-AzDisk -ResourceGroupName $rgName -Name $diskName

powershellConfigure The Managed Disk By Using Azure Powershell

In this section, you will be the managing configuration of the Azure managed disk by using the 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:

New-AzDiskUpdateConfig -DiskSizeGB 64 | Update-AzDisk -ResourceGroupName $rgName -DiskName $diskName

powershell2. To verify that the change took effect, run the following:

Get-AzDisk -ResourceGroupName $rgName -Name $diskName

3. To verify the current SKU as Standard_LRS, run the following:

(Get-AzDisk -ResourceGroupName $rgName -Name $diskName).Sku

powershell4. To change the disk performance SKU to Premium_LRS, from the PowerShell session within Cloud Shell, run the following:

New-AzDiskUpdateConfig -Sku Premium_LRS | Update-AzDisk -ResourceGroupName $rgName -DiskName $diskName

powershell5. To verify that the change took effect, run the following:

(Get-AzDisk -ResourceGroupName $rgName -Name $diskName).Sku

powershell

Conclusion

We are able to Started a PowerShell session in Azure Cloud Shell. Created a resource group and an Azure-managed disk by using Azure PowerShell. Configured the managed disk by using Azure PowerShell

Related Reference

Next Task For You

Begin your journey toward becoming a Microsoft Azure Administrator [AZ-104] by joining our FREE Class. We strongly recommend gaining knowledge from AZ-104 in order to be an effective Azure Administrator. Our course covers the AZ 104 certification. Click on the below image to register for the Free Class NOW!

microsoft-azure-administrator-blog-upgrade

The post Azure Managed Disks| Create Azure Manage Disk by Using Azure Power Shell appeared first on Cloud Training Program.


Viewing all articles
Browse latest Browse all 1901

Trending Articles