使用PS创建应用程序网关时出错 [英] Error when creating Application gateway with PS

查看:84
本文介绍了使用PS创建应用程序网关时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$ resGroupName =" XXXX-APIM-prj-RG"
$ location =" westeurope"
$ vnet = Get-AzVirtualNetwork -Name AKWA_VN -ResourceGroupName XXX-APIM-prj-RG
$ gatewayHostname =" api.XXXX.com" #API网关主机
$ portalHostname =" portal.XXXX.com" #API开发人员门户主机
#$ CertCerPath = Get-Content -LiteralPath C:\ kwa \akwagroupcert.cer -Force -Raw#api.contoso.net .cer文件的完整路径
$ CertPfxPath =" C:\\\\ [::::::::::::::
$ CertPfxPath =" C:\\\ [[[[[[[[[[[xXXX.pfx" #api.contoso.net .pfx文件的完整路径
$ CertPassword = ConvertTo-SecureString -String XXXX -AsPlainText -Force#密码为api.contoso.net pfx证书

$ appgatewaysubnetdata = Get-AzVirtualNetworkSubnetConfig -VirtualNetwork $ vnet -Name AKWAGW_Subnet



$ publicip = New-AzPublicIpAddress -ResourceGroupName $ resGroupName -name" appGWPIP01" -location $ location -AllocationMethod Dynamic
$ gipcogipconfignfig = New-AzApplicationGatewayIPConfiguration -Name" gatewayIP01" -SubnetId $ appgatewaysubnetdata



$ fp01 = New-AzApplicationGatewayFrontendPort -Name" port01" -Port 443

$ fipconfig01 = New-AzApplicationGatewayFrontendIPConfig -Name" frontend1" -PublicIPAddress $ publicip

$ cert = New-AzApplicationGatewaySslCertificate -Name" akwacert01" -CertificateFile $ CertPfxPath -Password $ CertPassword



$ listener = New-AzApplicationGatewayHttpListener -Name" listener01" - 协议"Https" -FrontendIPConfiguration $ fipconfig01 -FrontendPort $ fp01 -SslCertificate $ cert -HostName $ gatewayHostname -RequireServerNameIndication true
$ portalListener = New-AzApplicationGatewayHttpListener -Name" listener02" - 协议"Https" -FrontendIPConfiguration $ fipconfig01 -FrontendPort $ fp01 -SslCertificate $ cert -HostName $ portalHostname -RequireServerNameIndication true

$ apimprobe = New-AzApplicationGatewayProbeConfig -Name" apimproxyprobe" - 协议"Https" -HostName $ gatewayHostname -Path" / status-0123456789abcdef" -Interval 30 -Timeout 120 -UnalthyThreshold 8
$ apimPortalProbe = New-AzApplicationGatewayProbeConfig -Name" apimportalprobe" - 协议"Https" -HostName $ portalHostname -Path" / signin" -Interval 60 -Timeout 300 -UnhealthyThreshold 8


$ authcert = New-AzApplicationGatewayAuthenticationCertificate -Name'whiteelistcert1'CertificateFile C:\\\\ [[[[[[[[$ $ $ $ $ $ $ $ $ $



$ apimPoolSetting = New-AzApplicationGatewayBackendHttpSettings -Name" apimPoolSetting" -Port 443 -Protocol" Https" -CookieBasedAffinity" Disabled" -Probe $ apimprobe -AuthenticationCertificates $ authcert -RequestTimeout 180
$ apimPoolPortalSetting = New-AzApplicationGatewayBackendHttpSettings -Name" apimPoolPortalSetting" -Port 443 -Protocol" Https" -CookieBasedAffinity" Disabled" -Probe $ apimPortalProbe -AuthenticationCertificates $ authcert -RequestTimeout 180

$ apimService = Get-AzApiManagement -ResourceGroupName $ resGroupName

$ apimProxyBackendPool = New-AzApplicationGatewayBackendAddressPool -Name" apimbackend" -BackendIPAddresses $ apimService.PrivateIPAddresses [0]

$ rule01 = New-AzApplicationGatewayRequestRoutingRule -Name" rule1" -RuleType Basic -HttpListener $ listener -BackendAddressPool $ apimProxyBackendPool -BackendHttpSettings $ apimPoolSetting
$ rule02 = New-AzApplicationGatewayRequestRoutingRule -Name" rule2" -RuleType Basic -HttpListener $ portalListener -BackendAddressPool $ apimProxyBackendPool -BackendHttpSettings $ apimPoolPortalSetting

$ sku = New-AzApplicationGatewaySku -Name" WAF_Medium" -Tier"WAF" -Capacity 1

$ config = New-AzApplicationGatewayWebApplicationFirewallConfiguration -Enabled $ true -FirewallMode" Prevention"

$ appgwName =" akwa-app-gw"

$ appgw = New-AzApplicationGateway -Name $ appgwName -ResourceGroupName $ resGroupName -Location $ location -BackendAddressPools $ apimProxyBackendPool -BackendHttpSettingsCollection $ apimPoolSetting,$ apimPoolPortalSetting -FrontendIpConfigurations $ fipconfig01 -GatewayIpConfigurations $ gipconfig -FrontendPorts $ fp01 - HttpListeners $ listener,$ portalListener -RequestRoutingRules $ rule01,$ rule02 -Sku $ sku -WebApplicationFirewallConfig $ config -SslCertificates $ cert -AuthenticationCertificates $ authcert -Probes $ apimprobe,$ apimPortalProbe -Verbose


#$ appgw = New-AzApplicationGateway -Name $ appgwName -ResourceGroupName $ resGroupName -Location $ location -BackendAddressPools $ apimProxyBackendPool -BackendHttpSettingsCollection $ apimPoolSetting,$ apimPoolPortalSetting -FrontendIpConfigurations $ fipconfig01 -GatewayIpConfigurations $ gipconfig -FrontendPorts $ fp01 -HttpListeners $ listener,$ portalListener - RequestRoutingRules $ rule01,$ rule02 -Sku $ sku -WebApplicatio nFirewallConfig $ config -SslCertificates $ cert -TrustedRootCertificate $ cert -Probes $ apimprobe,$ apimPortalProbe -Verbose


Get-AzPublicIpAddress -ResourceGroupName $ resGroupName -Name" publicIP01"


$resGroupName = "XXXX-APIM-prj-RG" $location = "westeurope" $vnet = Get-AzVirtualNetwork -Name AKWA_VN -ResourceGroupName XXX-APIM-prj-RG $gatewayHostname = "api.XXXX.com" # API gateway host $portalHostname = "portal.XXXX.com" # API developer portal host #$CertCerPath = Get-Content -LiteralPath C:\akwa\akwagroupcert.cer -Force -Raw # full path to api.contoso.net .cer file $CertPfxPath = "C:\akwa\XXXX.cer" $CertPfxPath = "C:\akwa\XXXX.pfx" # full path to api.contoso.net .pfx file $CertPassword = ConvertTo-SecureString -String XXXX -AsPlainText -Force # password for api.contoso.net pfx certificate $appgatewaysubnetdata = Get-AzVirtualNetworkSubnetConfig -VirtualNetwork $vnet -Name AKWAGW_Subnet $publicip = New-AzPublicIpAddress -ResourceGroupName $resGroupName -name "appGWPIP01" -location $location -AllocationMethod Dynamic $gipcogipconfignfig = New-AzApplicationGatewayIPConfiguration -Name "gatewayIP01" -SubnetId $appgatewaysubnetdata $fp01 = New-AzApplicationGatewayFrontendPort -Name "port01" -Port 443 $fipconfig01 = New-AzApplicationGatewayFrontendIPConfig -Name "frontend1" -PublicIPAddress $publicip $cert = New-AzApplicationGatewaySslCertificate -Name "akwacert01" -CertificateFile $CertPfxPath -Password $CertPassword $listener = New-AzApplicationGatewayHttpListener -Name "listener01" -Protocol "Https" -FrontendIPConfiguration $fipconfig01 -FrontendPort $fp01 -SslCertificate $cert -HostName $gatewayHostname -RequireServerNameIndication true $portalListener = New-AzApplicationGatewayHttpListener -Name "listener02" -Protocol "Https" -FrontendIPConfiguration $fipconfig01 -FrontendPort $fp01 -SslCertificate $cert -HostName $portalHostname -RequireServerNameIndication true $apimprobe = New-AzApplicationGatewayProbeConfig -Name "apimproxyprobe" -Protocol "Https" -HostName $gatewayHostname -Path "/status-0123456789abcdef" -Interval 30 -Timeout 120 -UnhealthyThreshold 8 $apimPortalProbe = New-AzApplicationGatewayProbeConfig -Name "apimportalprobe" -Protocol "Https" -HostName $portalHostname -Path "/signin" -Interval 60 -Timeout 300 -UnhealthyThreshold 8 $authcert = New-AzApplicationGatewayAuthenticationCertificate -Name 'whitelistcert1' -CertificateFile C:\akwa\akwagroup.com.cer $apimPoolSetting = New-AzApplicationGatewayBackendHttpSettings -Name "apimPoolSetting" -Port 443 -Protocol "Https" -CookieBasedAffinity "Disabled" -Probe $apimprobe -AuthenticationCertificates $authcert -RequestTimeout 180 $apimPoolPortalSetting = New-AzApplicationGatewayBackendHttpSettings -Name "apimPoolPortalSetting" -Port 443 -Protocol "Https" -CookieBasedAffinity "Disabled" -Probe $apimPortalProbe -AuthenticationCertificates $authcert -RequestTimeout 180 $apimService = Get-AzApiManagement -ResourceGroupName $resGroupName $apimProxyBackendPool = New-AzApplicationGatewayBackendAddressPool -Name "apimbackend" -BackendIPAddresses $apimService.PrivateIPAddresses[0] $rule01 = New-AzApplicationGatewayRequestRoutingRule -Name "rule1" -RuleType Basic -HttpListener $listener -BackendAddressPool $apimProxyBackendPool -BackendHttpSettings $apimPoolSetting $rule02 = New-AzApplicationGatewayRequestRoutingRule -Name "rule2" -RuleType Basic -HttpListener $portalListener -BackendAddressPool $apimProxyBackendPool -BackendHttpSettings $apimPoolPortalSetting $sku = New-AzApplicationGatewaySku -Name "WAF_Medium" -Tier "WAF" -Capacity 1 $config = New-AzApplicationGatewayWebApplicationFirewallConfiguration -Enabled $true -FirewallMode "Prevention" $appgwName = "akwa-app-gw" $appgw = New-AzApplicationGateway -Name $appgwName -ResourceGroupName $resGroupName -Location $location -BackendAddressPools $apimProxyBackendPool -BackendHttpSettingsCollection $apimPoolSetting, $apimPoolPortalSetting -FrontendIpConfigurations $fipconfig01 -GatewayIpConfigurations $gipconfig -FrontendPorts $fp01 -HttpListeners $listener, $portalListener -RequestRoutingRules $rule01, $rule02 -Sku $sku -WebApplicationFirewallConfig $config -SslCertificates $cert -AuthenticationCertificates $authcert -Probes $apimprobe, $apimPortalProbe -Verbose #$appgw = New-AzApplicationGateway -Name $appgwName -ResourceGroupName $resGroupName -Location $location -BackendAddressPools $apimProxyBackendPool -BackendHttpSettingsCollection $apimPoolSetting, $apimPoolPortalSetting -FrontendIpConfigurations $fipconfig01 -GatewayIpConfigurations $gipconfig -FrontendPorts $fp01 -HttpListeners $listener, $portalListener -RequestRoutingRules $rule01, $rule02 -Sku $sku -WebApplicationFirewallConfig $config -SslCertificates $cert -TrustedRootCertificate $cert -Probes $apimprobe, $apimPortalProbe -Verbose Get-AzPublicIpAddress -ResourceGroupName $resGroupName -Name "publicIP01"

以上是我的剧本,但我面临以下错误 

the above is my script but I face the below error 

推荐答案

感谢您在这里发帖。

有在"西欧"中断区域管理操作失败。

There is an outage in "West Europe" region as management operations are getting failed.

此处有更多信息:  https://azure.microsoft.com/en-au/status/  

More info here: https://azure.microsoft.com/en-au/status/ 

 

你能不能通过改变位置值来尝试部署它。

 

 


location =" westeurope"到某个其他位置。
location = "westeurope" to some other location.

问候,

Subhash





这篇关于使用PS创建应用程序网关时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆