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