Thanks for getting back with detailed explanation. Yes, you can get the details of NetApp volumes mounted on virtual machines (VMs) in Azure using Azure CLI or Azure APIs.
- First List all the VMs in your subscription:
az vm list --query "[].{Name:name, ResourceGroup:resourceGroup}" -o table
- Use below command on the VMs to check the mounted NetApp volumes: You need to see that the Azure VM Agent is installed and running on the VMs for the run-command feature to work.
az vm run command invoke \
--command-id RunShellScript \
--name <VM_NAME> \
--resource-group <RESOURCE_GROUP> \
--scripts "df -h | grep -i netapp"
Please refer this document Execute a specific run command on a vm
You can also write a script that loops through all VMs retrieved and executes the az vm run command invoke
for each VM to collect the mounted volume details.Using Azure Rest API:
- List all VMs using Rest API in your subscription: Virtual Machines - List All
- You can use Run command API to execute your own scripts: Run Command API
If you have any further queries, please do let us know. If the answer is helpful, please click "Accept Answer" and "Upvote it."