Azure IAAS VM's comparison

ACDBA 416 Reputation points
2022-12-12T21:50:42.627+00:00

Hi All,

I have two node identical replicas having AG's. They are lifted to Azure from On-prem. I found similar difference in configuration. They dont match the sku's and disk configurations.

Eg:- Data drive is Standard SSD in one VM and Premium in second one.

Is there a ready made way i can compare the 2 nodes once its migrated to azure.

some scripts which connect to azure portal,fetch both these nodes,compare them and highlight the differences.

If i write a PS script, should i be using the template json files from both servers and compare or use get-azvm details and compare?

or any rest API methods?

What would be right method and simple method.

Thanks,
ACDBA

SQL Server on Azure Virtual Machines
Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,566 questions
0 comments No comments
{count} votes

Accepted answer
  1. KarishmaTiwari-MSFT 18,877 Reputation points Microsoft Employee
    2022-12-16T04:29:08.743+00:00

    @ACDBA Thanks for posting your query on Microsoft Q&A.
    There are various ways to compare the configuration differences between the two Azure VMs:

    Using PowerShell

    This would be a good option if you would like to automate the comparison mechanism.
    You can write a PowerShell script utilizing PowerShell cmdlet Get-AzVm to retrieve information about each VM. You can then compare the configuration properties (SKU, disk) of the returned VM objects using

    • Compare-object cmdlet or
    • StorageProfile.DataDisks property to get the data disks and storage type of the data disks attached to each VM, HardwareProfile.VmSize property to get the SKU and compare them using PowerShell's comparison operators, such as -eq for equality or -ne for inequality.

    Reference doc:
    Get-AzVM
    Output : PSVirtualMachine

    Using REST API

    This is another good choice if automation is the goal.
    You can use the Azure VM REST API :

    GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}   
    

    to retrieve information about a VM, and then compare the properties of the returned VM object in the API response, as needed.
    Reference documentation: https://learn.microsoft.com/en-us/rest/api/compute/virtual-machines/get?tabs=HTTP#virtualmachine

    Using ARM template

    You would want to choose this option if you would like to manage the configuration of your VMs / just want to compare the VMs one time to identify the differences. You can compare the ARM templates of both VMs manually or using any tool for comparing templates.

    Hope that helps.

    ----------

    Please "Accept as Answer" if any answer/reply helped, so that others in the community facing similar issues can easily find the solution.
    If you have any further query, do let me know in the comments and I would be happy to investigate further.

    0 comments No comments

0 additional answers

Sort by: Most helpful