如何获取Azure Function App入站流量限制等网络配置详情
Azure Function App入站流量相关配置获取方案
你之前调用的get和get_configuration接口只能拿到基础配置和访问限制规则,其余网络相关配置需要调用专用的网络类接口才能获取。你需要的几类配置具体获取方法如下:
- 访问限制(Access Restriction)
该配置存储在站点配置接口的ip_security_restrictions字段中,调用示例:
from azure.mgmt.web import WebSiteManagementClient # 初始化客户端代码省略 app_config = mgmt_client.web_apps.get_configuration(resource_group_name=resource_group, name=app_name).as_dict() access_restriction_rules = app_config.get('ip_security_restrictions', [])
- 入站IP地址(Inbound IPs)
可用入站IP列表在站点基础信息的possible_inbound_ip_addresses字段中,调用示例:
func_app_base = mgmt_client.web_apps.get(resource_group_name=resource_group, name=app_name).as_dict() inbound_ip_list = func_app_base.get('possible_inbound_ip_addresses', '').split(',')
- 应用分配地址(App assigned address)
虚拟网络集成分配的专属地址需要调用网络特性接口获取,调用示例:
network_features = mgmt_client.web_apps.list_network_features( resource_group_name=resource_group, name=app_name, view="full" ).as_dict() app_assigned_vnet_ip = network_features.get('virtual_network_connection', {}).get('assigned_ip_address')
- 私有端点(Private endpoints)
私有端点配置需要调用专用的私有端点连接接口获取,调用示例:
private_endpoint_connections = mgmt_client.web_apps.list_private_endpoint_connections( resource_group_name=resource_group, name=app_name ) private_endpoint_list = [item.as_dict() for item in private_endpoint_connections]
组合上述几个接口的返回结果,就能拿到你在门户中查看的全部入站相关配置。
内容的提问来源于stack exchange,提问作者Steve_Greenwood
相关产品推荐
相关产品推荐

