Here I'm going to show the steps that you can follow to expand your Azure VM Operating system Disk.
There are a couple of ways to do this and here I'm using the PowerShell to do the work .
First, you can try to run the below command on your PowerShell and check whether you can connect to your Microsoft Azure account in resource management (ARM) mode.
PS C:\Windows\system32> Login-AzureRmAccount
If this doesn't give an Azure portal sign-in window, then first you have to install the ARM or the latest version of the
Azure powershell from the Gallery using an elevated Windows PowerShell. (ARM installation steps will post in the next post)
Then you can test the Azure connectivity by typing below command,
PS C:\Windows\system32> Login-AzureRmAccount
If you can get the below mentioned windows means, you can go into the next step.
If you are using PowershellISE then this will be easy for you to run the below script. Copy and paste the below script and Copy and paste the correct values for
Name_of_the_Azure_subscription, Name_of_the_Resource_Group, Name_of_the_Server and give the correct capacity for the OS Disk.
Login-AzureRmAccount
Select-AzureRmSubscription -SubscriptionName 'Name_of_the_Azure_subscription'
$rgName = 'Name_of_the_Resource_Group'
$vmName = 'Name_of_the_Server'
$vm = Get-AzureRmVM -ResourceGroupName $rgName -Name $vmName
Stop-AzureRmVM -ResourceGroupName $rgName -Name $vmName
$vm.StorageProfile.OSDisk.DiskSizeGB = 1023
Update-AzureRmVM -ResourceGroupName $rgName -VM $vm
Start-AzureRmVM -ResourceGroupName $rgName -Name $vmName
You can download this from here.
Once you run the Script, It will ask for the credentials. Give that and hit Sign in.
This information window will pop up and you can hit yes.
Once the task completed, you will get the below "Succeeded" alert with the Start, Stop time.
Connect into your VM and go into "Disk Management". You will see the Unallocated space. From there you will be able to extend the OS Disk.
Hope this helps you to expand your Azure VM OS Disk.
No comments:
Post a Comment