如何使用python SDK创建Azure应用程序网关

问题描述 投票:0回答:1

我开始觉得有点傻了。有人能够使用Python SDK for Azure成功创建应用程序网关吗?文档似乎没问题,但我正在努力寻找合适的参数来传递azure.mgmt.network.operations.ApplicationGatewaysOperations application_gateways.create_or_update()的'参数'。我为load_balancer找到了一个完整的工作示例,但找不到任何适用于Application Gateway的东西。获取'字符串索引必须是整数,而不是str'根本没有帮助。任何帮助将不胜感激,谢谢! 更新:解决了。对于每个人这样做的建议,请仔细查看Application gateway params所需的数据类型

python azure azure-application-gateway
1个回答
1
投票

我知道目前没有针对Application Gateway的Python示例,我为此道歉...现在我建议您:

Github tracker上打开一个问题,这样你就可以在我做样本时(或至少你可以模仿的单元测试)。

在评论中编辑问题:

获得VM对象后获取VM的IP:

# 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

编辑:

我终于写了样本:

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

(我在MS工作,我负责Azure SDK for Python)

© www.soinside.com 2019 - 2024. All rights reserved.