b0r0
b0r0

Reputation: 5

Microsoft Azure: obtaining public IP on Linux with azure API for Python

Could someone advice me or show me example of how to obtain public IP through Azure API on linux? I know that I can obtain public IP through wget, curl etc. but those use external domain and I would like to avoid it. There is some SDK for Python but I couldn't run any function.

I think maybe one of these my return what I need:
NetworkInterfaceIPConfigurationsOperations class
NetworkInterfacesOperations class

Upvotes: 0

Views: 840

Answers (1)

Laurent Mazuel
Laurent Mazuel

Reputation: 3546

You should start with the Python tutorial https://learn.microsoft.com/en-us/python/azure/python-sdk-azure-get-started?view=azure-python

And then some network example: https://learn.microsoft.com/en-us/python/api/overview/azure/network?view=azure-python

Once you're confortable with the NetworkManagementClient client, you can do:

    result_get = network_client.public_ip_addresses.get(
        resource_group_name,
        public_ip_name,
    )

network_client.public_ip_addresses being an instance of https://learn.microsoft.com/en-us/python/api/azure.mgmt.network.v2018_02_01.operations.publicipaddressesoperations?view=azure-python

Upvotes: 1

Related Questions