@Varma Welcome to Microsoft Q&A Forum, Thank you for posting your query here!
Adding more information to the above response.
- There are several changes that can lead to a change in the number of data disks in an Azure VM or image. Some of these changes include:
Resizing the VM: When you resize a VM to a different size, the number of data disks that can be attached to the VM may change. For example, if you resize a VM to a smaller size, you may not be able to attach as many data disks as you could with the previous size.
Adding or removing data disks: Adding or removing data disks to a VM can change the number of data disks associated with the VM.
Creating a new VM from an image: When you create a new VM from an image, the number of data disks associated with the new VM may be different from the original VM.
Updating the VM image: If you update the VM image, the number of data disks associated with the image may change.
- Changing the storage account type: Changing the storage account type associated with a VM can affect the number of data disks that can be attached to the VM
- You can use the Azure CLI command
az sig image-version list
to list the images in a gallery. Here is an example of how to use this command: az sig image-version
Please replace MyGallery
, MyImageDefinition
, and MyResourceGroup
with your actual gallery name, image definition, and resource group respectively.
After you have the list of images, you can count the data disks for each image using additional commands like az stack-hci-vm disk list
or az disk list
. Please note that you would need to iterate over each image and count the disks separately.
az sig image-version list --gallery-name MyGallery --gallery-image-definition MyImageDefinition --resource-group MyResourceGroup
$imageList = Get-AzGalleryImage -ResourceGroupName $resourceGroup -GalleryName $galleryName
Please let us know if you have any further queries. I’m happy to assist you further.
---Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.