我正在为托管在 Web 应用上的 Web 应用设置 Azure 应用程序网关 Web 应用程序防火墙,并且所有内容均采用 SSL 保护。
我可以使用此文章在一切都不是 SSL 时使其工作 https://docs.microsoft.com/en-us/azure/application-gateway/application-gateway-web-app-powershell
但是当我尝试将其更改为 SSL 并上传 CER 文件时,我无法让它显示 Heathly。我将所有引用更改为 https,一切看起来都正确,但我仍然卡住了
我也尝试过这篇文章https://docs.microsoft.com/en-us/azure/application-gateway/application-gateway-end-to-end-ssl-powershell 没有运气
对我遗漏的内容有什么想法吗?需要这个功能才能使用 HA 解决方案
谢谢亚历克斯
答案1
以下是 MS 支持人员与我合作编写的脚本,以使此功能正常运行
# FQDN of the web app
$webappFQDN = "XXX.XXXXX.com"
# Retrieve an existing application gateway
$gw = Get-AzureRmApplicationGateway -Name "XXXX" -ResourceGroupName "XXXX"
# Define the status codes to match for the probe
$match=New-AzureRmApplicationGatewayProbeHealthResponseMatch -StatusCode 200-399
# Add a new probe to the application gateway
Add-AzureRmApplicationGatewayProbeConfig -name webappprobe-1 -ApplicationGateway $gw -Protocol Https -Path / -Interval 30 -Timeout 120 -UnhealthyThreshold 3 -PickHostNameFromBackendHttpSettings -Match $match
# Retrieve the newly added probe
$probe = Get-AzureRmApplicationGatewayProbeConfig -name webappprobe-1 -ApplicationGateway $gw
# Configure an existing backend http settings
Set-AzureRmApplicationGatewayBackendHttpSettings -Name appGatewayBackendHttpSettings -ApplicationGateway $gw -PickHostNameFromBackendAddress -Port 443 -Protocol https -CookieBasedAffinity Disabled -RequestTimeout 30 -Probe $probe
Exclude these 2 lines
#$authcert = New-AzureRmApplicationGatewayAuthenticationCertificate -Name whitelistcert1 -CertificateFile C:\XXXX\XXXX.cer
#Set-AzureRmApplicationGatewayBackendHttpSettings -Name appGatewayBackendHttpSettings -ApplicationGateway $gw -PickHostNameFromBackendAddress -Port 443 -Protocol Https -CookieBasedAffinity Enabled -AuthenticationCertificates $authcert
# Add the web app to the backend pool
Set-AzureRmApplicationGatewayBackendAddressPool -Name appGatewayBackendPool -ApplicationGateway $gw -BackendFqdns $webappFQDN
# Update the application gateway
Set-AzureRmApplicationGateway -ApplicationGateway $gw