Get IP from VM object using azure sdk in python
<p>I am trying to get all the IPs (attached to VMs) from an azure subscription.</p>

<p>I have pulled all the VMs using </p>

<pre><code>compute_client = ComputeManagementClient(credentials, subscription_id)
network_client = NetworkManagementClient(credentials,subscription_id)


 for vm in compute_client.virtual_machines.list_all():
      print(vm.network_profile.network_interface)
</code></pre>

<p>But the network_profile object seems to only be a pointer, I have read through the documentation and can not figure out how to link each vm to its attached IP addresses </p>

<p>I came across this: <a href="https://stackoverflow.com/questions/37265885/is-there-any-python-api-which-can-get-the-ip-address-internal-or-external-of-v">Is there any python API which can get the IP address (internal or external) of Virtual machine in Azure</a></p>

<p>But it seems that something has changed. </p>

<p>I am able to resolve the IPs of a machine only if I know the name of the Public_IP address object(Which not all of them have public IPs). </p>

<p>I need to be able to take this network_interface and resolve the IP on it</p>