def _set_instance_ip(self):
        """
        Get the IP address based on instance ID.

        If public IP address not found attempt to get private IP.
        """
        try:
            ip_address = self.network.public_ip_addresses.get(
                self.running_instance_id, self.public_ip_name
            ).ip_address
        except Exception:
            try:
                ip_address = self.network.network_interfaces.get(
                    self.running_instance_id, self.nic_name
                ).ip_configurations[0].private_ip_address
            except Exception as error:
                raise AzureCloudException(
                    'Unable to retrieve instance IP address: {0}.'.format(
                        error
                    )
                )

        self.instance_ip = ip_address
def _set_instance_ip ( self ) : try : ip_address = self . network . public_ip_addresses . get ( self . running_instance_id , self . public_ip_name ) . ip_address except Exception : try : ip_address = self . network . network_interfaces . get ( self . running_instance_id , self . nic_name ) . ip_configurations [ 0 ] . private_ip_address except Exception as error : raise AzureCloudException ( 'Unable to retrieve instance IP address: {0}.' . format ( error ) ) self . instance_ip = ip_address
Get the IP address based on instance ID.

        If public IP address not found attempt to get private IP.