I am looking for a way to dissociate public IP addresses from my nic that is associated with a VM that is part of a scale set. There is ways to do it through the Azure portal and CLI (https://learn.microsoft.com/en-us/azure/virtual-network/remove-public-ip-address-vm). My question is that is there a way to do it through azure python or ruby SDK?
I have tried thenetwork_client.network_interfaces.create_or_update(GROUP_NAME, nic.name, nic_params) approach. However, I am not quite sure what to set for the nic_params field. Existing document indicate that the field is of the format:
nic_params = {
'location': LOCATION,
'ip_configurations':[{
'name': ipconfig_name,
'public_ip_address':ip_address_object,
'subnet': {
'id': subnet_info.id
}
}]
}
ip_configuration to null, public_ip_address to null. Neither approach worked.
The basic idea is to simply set the public ip address to "null".
These links should help you:
I don't know python, but the code would probably start something like this: