Advertisement
Guest User

patkica

a guest
Aug 21st, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. # Get the application gateway
  2. $gw = Get-AzureRmApplicationGateway -Name DHProductionGatewayFE -ResourceGroupName DeployHandler
  3.  
  4. # Get the existing HTTPS listener
  5. $httpslistener = Get-AzureRmApplicationGatewayHttpListener -Name appgatewayhttplistener -ApplicationGateway $gw
  6.  
  7. # Get the existing front end IP configuration
  8. $fipconfig = Get-AzureRmApplicationGatewayFrontendIPConfig -Name appgatewayfrontendip -ApplicationGateway $gw
  9.  
  10. # Add a new front end port to support HTTP traffic
  11. Add-AzureRmApplicationGatewayFrontendPort -Name appGatewayFrontendPort2 -Port 80 -ApplicationGateway $gw
  12.  
  13. # Get the recently created port
  14. $fp = Get-AzureRmApplicationGatewayFrontendPort -Name appGatewayFrontendPort2 -ApplicationGateway $gw
  15.  
  16. # Create a new HTTP listener using the port created earlier
  17. Add-AzureRmApplicationGatewayHttpListener -Name appgatewayhttplistener2 -Protocol Http -FrontendPort $fp -FrontendIPConfiguration $fipconfig -ApplicationGateway $gw
  18.  
  19. # Get the new listener
  20. $listener = Get-AzureRmApplicationGatewayHttpListener -Name appgatewayhttplistener2 -ApplicationGateway $gw
  21.  
  22. # Add a redirection configuration using a permanent redirect and targeting the existing listener
  23. Add-AzureRmApplicationGatewayRedirectConfiguration -Name redirectHttptoHttps -RedirectType Permanent -TargetListener $httpslistener -IncludePath $true -IncludeQueryString $true -ApplicationGateway $gw
  24.  
  25. # Get the redirect configuration
  26. $redirectconfig = Get-AzureRmApplicationGatewayRedirectConfiguration -Name redirectHttptoHttps -ApplicationGateway $gw
  27.  
  28.  
  29. # Add a new rule to handle the redirect and use the new listener
  30. Add-AzureRmApplicationGatewayRequestRoutingRule -Name rule02 -RuleType Basic -HttpListener $listener -RedirectConfiguration $redirectconfig -ApplicationGateway $gw
  31.  
  32. # Update the application gateway
  33. Set-AzureRmApplicationGateway -ApplicationGateway $gw
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement