Home > Software engineering >  [Azure SDK Python]How to check if a subnet has available IPs?
[Azure SDK Python]How to check if a subnet has available IPs?

Time:11-29

is there a way in Azure SDK Python to check if a subnet has still available IPs?

We need this info because we dinamically deploy VMs in different subnets and we have to know if there is still network availabiliy before provisioning in that subnet.

I tried to search on SO and on Azure docs but with no success. I've just found commands in Azure CLI/Rest APIs but I don't know if there is something equivalent also in python.

If no, how could I proceed with REST APIs?

Thank you a lot for your support.

CodePudding user response:

I do not think Azure Python SDK offers such functionality out of the box; you can create a feedback item for this on the Azure Python SDK repository.

If it helps Azure Python SDK does offer a check_ip_address_availability module but it only validates if a given single private IP address is available for use. You can use this code as reference.

Other option here will be to use the REST API mentioned by you above to get the required details.

  • Related