简体   繁体   中英

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

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

And then some network example: https://docs.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://docs.microsoft.com/en-us/python/api/azure.mgmt.network.v2018_02_01.operations.publicipaddressesoperations?view=azure-python

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM