How do I get instance id/name from public ip address of VM in azure via python sdk
问题 def get_instance_id_from_pip(self, pip): subscription_id="69ff3a41-a66a-4d31-8c7d-9a1ef44595c3" compute_client = ComputeManagementClient(self.credentials, subscription_id) network_client = NetworkManagementClient(self.credentials, subscription_id) print("Get all public IP") for public_ip in network_client.public_ip_addresses.list_all(): if public_ip.ip_address == pip: print(public_ip) # Get id pip_id= public_ip.id.split('/') print("pip id : {}".format(pip_id)) rg_from_pip = pip_id[4].lower()