我已经在应用程序网关的前面部署了 Azure Front Door。现在我想通过 Front Door 路由所有流量,并限制对应用程序网关公共 IP 地址的直接访问。怎么做?
3046 次
2 回答
5
我从 Microsoft Azure 支持部门得到了答案。我需要添加一个网络安全组 (NSG) 并将应用程序网关子网链接到它。NSG 入站规则:
源:服务标签
源服务标签:AzureFrontDoor.Backend
源端口范围:*
目标:任何
目标端口范围:*
协议:任何
操作:允许
优先级:200
源:服务标签
源服务标签:GatewayManager
源端口范围:*
目标:任意
目标端口范围:65200-65535
协议:任意
操作:允许
优先级:300
源:服务标签
源服务标签:VirtualNetwork
源端口范围:*
目标:任何
目标端口范围:*
协议:任何
操作:允许
优先级:400
源:服务标签
源服务标签:AzureLoadBalancer
源端口范围:*
目标:任何
目标端口范围:*
协议:任何
操作:允许
优先级:500
源:
任何源端口范围:*
目标:任何
目标端口范围:*
协议:任何
操作:拒绝
优先级:600
于 2020-07-08T10:12:55.077 回答
1
在Microsoft 文档中,这些是附加到您需要的应用程序网关子网的网络安全组规则:
Azure CLI 示例:
# Set up reusable variables
app="myapp"; echo $app
env="prod"; echo $env
l="eastus2"; echo $l
tags="env=$env app=$app"; echo $tags
app_rg="rg-$app-$env"; echo $app_rg
agic_nsg_n="nsg-agic-$app-$env"; echo $agic_nsg_n
# Creates an AGW NSG with Default rules
az network nsg create \
--resource-group $app_rg \
--name $agic_nsg_n \
--location $l \
--tags $tags
# AllowGatewayManagerInbound
az network nsg rule create \
--name AllowGatewayManagerInbound \
--direction Inbound \
--resource-group $app_rg \
--nsg-name $agic_nsg_n \
--priority 300 \
--destination-port-ranges 65200-65535 \
--protocol TCP \
--source-address-prefixes GatewayManager \
--destination-address-prefixes "*" \
--access Allow
# AllowAzureFrontDoor.BackendInbound
az network nsg rule create \
--name AllowAzureFrontDoor.Backend \
--direction Inbound \
--resource-group $app_rg \
--nsg-name $agic_nsg_n \
--priority 200 \
--destination-port-ranges 443 80 \
--protocol TCP \
--source-address-prefixes AzureFrontDoor.Backend \
--destination-address-prefixes VirtualNetwork \
--access Allow
假设是:
- 来自 Azure Front Door 的传入流量通过端口 80 HTTP 或 443 HTTPs。如果需要,请更新端口或使用 Any。
- 我在配置为应用程序网关入口控制器 (AGIC) 的应用程序网关后面有一个 Azure Kubernetes 服务,因此目标是 VirtualNetwork。同样,根据您的具体情况,您可以对其进行更新或将其保留为 Any。
这也是Azure 目录中的完整GitHub代码示例。
于 2021-07-23T05:03:45.363 回答