I'm trying to retrieving the Fault Domain ID of a VM inside an availability set. Those ID's are assigned "by random" to the virtual machines in question but it is important for me and the application to know what fault domain id the vm is assigned to. (By random b/c we generate the ~21 VMs at the same time using terraform)
On the web portal of azure, this information is retrievable if you look at the availability set.
What I have tried:
Azure CLI --expand instanceView
On the page View Fault and Update Domains of virtual machine in Azure through Python Script they gave me an example of a command: this gives an error on the --expand attribute
az vm show -g [ResourceGroup] -n [VM_NAME] --expand instanceView
az: error: unrecognized arguments: --expand instanceView
usage: az [-h] [--verbose] [--debug] [--output {json,jsonc,table,tsv}]
[--query JMESPATH]
{vm} ...
Azure CLI without --expand instanceView
This doesn't give an error but also does not give me the attribute.
Powershell
I also tried it whit Powershell but no success.
Get-AzureRmVM -ResourceGroupName $rg.ResourceGroupName | convertTo-json
Get-AzureRmAvailabilitySet -ResourceGroupName $rg.ResourceGroupName | convertTo-json
Does anyone have any idea how to retrieve the Domain Fault ID?