I had a question. For Azure, I can figure out the subnets within a VNet by using either the cq_id and cq_parent_id relation or using the etags. Now, I want to find out the virtual machines within a subnet.
Any idea where I can find this relation? In the subnets and virtual machines table, I did not find any such way to map.
Hi @relevant-primate I did a bit of digging into this.
Can you check azure_network_interfaces?
Looks like it has properties->virtualMachine and properties->ipConfigurations. The latter is an array where each item has properties->subnet.
Correlating VMs and subnets on Azure.
If that doesn’t work, maybe reach out to Azure support to understand if that data is available in the REST API, then we can add it to CloudQuery.
Hi @erez, thanks for helping me out. Yes, I can figure out a way from your solution.
Also, I checked the Azure REST API documentation here.
I believe currently CloudQuery is only taking the first element in the networkProfile object, i.e., networkInterfaces. There are three elements in the array, the third one being networkInterfaceConfigurations, which has the subnet ID.
If CloudQuery can incorporate it, it will be a huge savior, as the solution suggested by you will need an iteration of the network_interfaces table every time we have a CloudQuery sync, as there is no relation between the virtual_machines and network_interfaces tables.
Sorry for the delayed response; I just got around to looking at the docs. CloudQuery saves the response from Azure as a JSON, so I’m not sure what’s missing.
Please share the data you’re seeing vs. the data you’re expecting to see. It would also be helpful if you can return the data that the Azure CLI returns when using the same API.