How to automatically extend the virtual machine vertically based on memory metrics

The virtual machine on Azure can monitor the guest operating system’s data, such as CPU, memory usage, and so on, by enabling guest OS diagnostic data collection. And even better, we can also manage VMs based on monitored data, such as vertical scaling. This article will talk about how to use the memory usage to automatically extend the virtual machine vertically. 1. First enable guest OS diagnostics data collection so that we can collect more disk, CPU, and memory data. If it is not checked during creation, it can be configured by monitoring the diagnostic settings in the VM panel.... Read more

How to move managed disk from one region to another

If you have spent a lot of time and effort on Azure application setup in a region and do not want to rebuild the entire disk in another region, managed disk migration is a good choice. Azure managed disks simplify the disk management of the Azure IaaS VM by managing storage accounts associated with VM disks, but this also prevents the use of VHD files in storage accounts to create managed disks in different regions. So how do we move Azure managed disks from one region to another? 1,first we need to create a source storage account for migration. $rgName ="roger02"... Read more

Why fetching VMs in a subscription via REST API misses some VMs

Some customers got the issue that the amount  of Azure VMs you retrieved using  REST API and PowerShell is different  . Because when you try to fetch VMs via REST API and amount of VMs reaches the page size limits . The VMs will be divided into several pages . Example This is the script that I use to fetch the VMs via REST API without considering the paging: #get the access token $body=@{ grant_type="client_credentials" resource="" client_id="your_client_id" client_secret="your_client_secret" } $tokenResponse=Invoke-RestMethod -Uri -Method Post -Body $body $access_token=$tokenResponse.access_token # Get subscription ID $header =@{ "Content-Type"="application/json" "Authorization"="Bearer $access_token" } $uri1 = "" $subscriptions = Invoke-RestMethod -Uri $Uri1 -Method Get... Read more

How to convert a VM from managed disks to unmanaged disks

Recently, managed disk has been published as a new feature. Azure Managed Disks simplifies disk management for Azure IaaS VMs by managing the storage accounts associated with the VM disks. You only have to specify the type (Premium or Standard) and the size of disk you need, and Azure creates and manages the disk for you. There is also a tutorial for you to help you convert a virtual machine from unmanaged disks to managed disks ( With the Azure PowerShell, you can easily finish the job. However, someone of you may want to return back to use unmanaged disk. To... Read more

How to migrate a VM from classic virtual network to an ARM one

As a new deployment model,ARM deployment model is much more flexible than the classic one.However,since the great architectural divide of this two deployment models , some resources under ASM deployment model is not compatible with the resources deployed by ARM model. For instance,we can’t migrate VMs deployed by ASM model in classic VNET to ARM VNET directly.And this blog will provide an easy way to do it. Now,I have two resource groups: ARMDemo and ASMDemo: each of them has a Windows VM and the VM is deployed in a VNET. The resources in first group is deployed by ARM model and the second is under... Read more

Add, Remove and Resize VM Data Disk using Azure REST API

It is a common need that some developers want to add, remove or resize VM data disk when they decide to take a secondary development on Azure VM service. Now, this article will show you how to implement it by Azure REST API. Before we start, you should know the size of your VM, because the availability of disk type and disk amount could be different from various sizes of the VM. You will get an error response if you tried to add a disk whose type was not support by your VM. For more infomation, please see : Sizes for Windows... Read more