简体   繁体   中英

How to create Azure Application gateway using python SDK

I'm starting to feel a bit stupid. Have someone been able to successfully create an Application gateway using Python SDK for Azure? The documentation seems ok, but I'm struggling with finding the right parameters to pass 'parameters' of azure.mgmt.network.operations.ApplicationGatewaysOperations application_gateways.create_or_update(). I found a complete working example for load_balancer but can't find anything for Application gateway. Getting 'string indices must be integers, not str' doesn't help at all. Any help will be appreciated, Thanks!

Update: Solved. An advice for everyone doing this, look carefully for the type of data required for the Application gateway params

I know there is no Python sample for Application Gateway currently, I apologize for that... Right now I suggest you to:

Open an issue on the Github tracker , so you can follow when I do a sample (or at least a unit test you can mimic).

Edit after question in comment:

To get the IP of VM once you have a VM object:

# Gives you the ID if this NIC
nic_id = vm.network_profile.network_interfaces[0].id
# Parse this ID to get the nic name
nic_name = nic_id.split('/')[-1]
# Get the NIC instance
nic = network_client.network_interfaces.get('RG', nic_name)
# Get the actual IP
nic.ip_configurations[0].private_ip_address

Edit:

I finally wrote the sample:

https://github.com/Azure-Samples/network-python-manage-application-gateway

(I work at MS and I'm responsible of the Azure SDK for 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