Notitie
Voor toegang tot deze pagina is autorisatie vereist. U kunt proberen u aan te melden of de directory te wijzigen.
Voor toegang tot deze pagina is autorisatie vereist. U kunt proberen de mappen te wijzigen.
U kunt Azure PowerShell gebruiken om op URL's gebaseerde routeringsregels te configureren wanneer u een toepassingsgateway maakt. In deze zelfstudie maakt u back-endpools met behulp van schaalsets voor virtuele machines. Vervolgens maakt u URL-routeringsregels waarmee webverkeer wordt omgeleid naar de juiste back-endpool op basis van het aanvraag-URL-pad. U kunt Azure PowerShell gebruiken om geavanceerde regels voor routering op basis van URL's te configureren wanneer u een toepassingsgateway maakt.
In deze zelfstudie wordt aandacht besteed aan configuraties die gereed zijn voor productie, waaronder aanbevolen beveiligingsprocedures, prestatieoptimalisatie en bewakingsinstellingen.
In deze handleiding leer je hoe je:
- De netwerkinfrastructuur instellen
- Een toepassingsgateway maken met padgebaseerde routering
- Listeners en routeringsregels toevoegen voor URL-omleiding
- Schaalsets voor virtuele machines voor back-endpools maken
- De functionaliteit voor routering en omleiding van de toepassingsgateway testen
Het volgende voorbeeld toont siteverkeer afkomstig van de poorten 8080 en 8081 en dat wordt doorgestuurd naar dezelfde back-endpools:
Vereiste voorwaarden
Als u wilt, kunt u deze procedure voltooien met behulp van Azure CLI.
Voordat u aan deze zelfstudie begint, moet u het volgende doen:
- Een actieve Azure-abonnement. Maak een gratis account als u er nog geen hebt.
- Azure PowerShell-moduleversie 5.4.1 of hoger lokaal geïnstalleerd, of toegang tot Azure Cloud Shell
- Machtigingen voor bijdrager of eigenaar op de doelsubscriptie in Azure
- Basiskennis van Application Gateway-concepten en PowerShell-scripts
Notitie
Het wordt aanbevolen de Azure Az PowerShell-module te gebruiken om te communiceren met Azure. Zie Azure PowerShell installeren om aan de slag te gaan. Raadpleeg Azure PowerShell migreren van AzureRM naar Az om te leren hoe u naar de Azure PowerShell-module migreert.
Azure Cloud Shell
Azure host Azure Cloud Shell, een interactieve shell-omgeving die u via uw browser kunt gebruiken. U kunt Bash of PowerShell gebruiken met Cloud Shell om met Azure-services te werken. U kunt de vooraf geïnstalleerde Cloud Shell-opdrachten gebruiken om de code in dit artikel uit te voeren zonder dat u iets hoeft te installeren in uw lokale omgeving.
Om Azure Cloud Shell op te starten:
Optie | Voorbeeld/koppeling |
---|---|
Selecteer Uitproberen in de rechterbovenhoek van een code- of opdrachtblok. Als u Try It selecteert, wordt de code of opdracht niet automatisch gekopieerd naar Cloud Shell. |
![]() |
Ga naar https://shell.azure.com, of selecteer de knop Cloud Shell starten om Cloud Shell in uw browser te openen. |
![]() |
Klik op de knop Cloud Shell in het menu in de balk rechtsboven in de Azure-portal. |
![]() |
Azure Cloud Shell gebruiken:
Start Cloud Shell.
Selecteer de knop Kopiëren op een codeblok (of opdrachtblok) om de code of opdracht te kopiëren.
Plak de code of opdracht in de Cloud Shell-sessie door CtrlShift++ in Windows en Linux te selecteren of door Cmd++ te selecteren in macOS.
Selecteer Enter om de code of opdracht uit te voeren.
Als u PowerShell lokaal wilt installeren en gebruiken, is voor deze zelfstudie versie 5.4.1 of hoger van de Azure PowerShell-module vereist. Voer Get-Module -ListAvailable Az
uit om de versie te zoeken. Als u PowerShell wilt upgraden, raadpleegt u De Azure PowerShell-module installeren. Als u PowerShell lokaal uitvoert, moet u ook Connect-AzAccount
uitvoeren om verbinding te kunnen maken met Azure.
Een brongroep maken
Een resourcegroep is een logische container waarin Azure-resources worden geïmplementeerd en beheerd. Maak een Azure-resourcegroep met behulp van New-AzResourceGroup.
# Define variables for consistent naming and easier management
$resourceGroupName = "myResourceGroupAG"
$location = "eastus"
# Create the resource group
New-AzResourceGroup -Name $resourceGroupName -Location $location
# Verify the resource group creation
Write-Output "Resource group '$resourceGroupName' created successfully in '$location'"
Netwerkbronnen maken
Maak de subnetconfiguraties voor myBackendSubnet en myAGSubnet met behulp van New-AzVirtualNetworkSubnetConfig. Maak het virtuele netwerk met de naam myVNet met behulp van New-AzVirtualNetwork met de subnetconfiguraties. Maak ten slotte het openbare IP-adres met de naam myAGPublicIPAddress met behulp van New-AzPublicIpAddress. Deze resources bieden netwerkconnectiviteit met de toepassingsgateway en de bijbehorende resources.
Belangrijk
Het subnet van de toepassingsgateway (myAGSubnet) kan alleen toepassingsgateways bevatten. Er zijn geen andere resources toegestaan in dit subnet. Maak de subnetconfiguraties voor myBackendSubnet en myAGSubnet met behulp van New-AzVirtualNetworkSubnetConfig. Voor de toepassingsgateway is een toegewezen subnet met minimaal /24 CIDR vereist voor de juiste werking en toekomstige schaalaanpassing. Maak het virtuele netwerk met de naam myVNet met behulp van New-AzVirtualNetwork met de subnetconfiguraties. Maak ten slotte het openbare IP-adres met Standard SKU en statische toewijzing voor verbeterde beveiliging en prestaties door gebruik te maken van New-AzPublicIpAddress.
# Create backend subnet configuration with appropriate CIDR for scale sets
$backendSubnetConfig = New-AzVirtualNetworkSubnetConfig `
-Name myBackendSubnet `
-AddressPrefix 10.0.1.0/24
# Create Application Gateway subnet - dedicated subnet required
$agSubnetConfig = New-AzVirtualNetworkSubnetConfig `
-Name myAGSubnet `
-AddressPrefix 10.0.2.0/24
New-AzVirtualNetwork `
-ResourceGroupName myResourceGroupAG `
-Location eastus `
-Name myVNet `
-AddressPrefix 10.0.0.0/16 `
-Subnet $backendSubnetConfig, $agSubnetConfig
New-AzPublicIpAddress `
-ResourceGroupName myResourceGroupAG `
-Location eastus `
-Name myAGPublicIPAddress `
-AllocationMethod Dynamic
Een toepassingsgateway maken
In deze sectie kunt u resources maken die ondersteuning bieden voor de toepassingsgateway. Ten slotte maakt u deze. De resources die u maakt, zijn onder andere:
- IP-configuraties en front-endpoort: hiermee koppelt u het subnet dat u eerder hebt gemaakt aan de toepassingsgateway en wijst u een poort toe die u gebruikt om de gateway te openen.
- Standaardpool: alle toepassingsgateways moeten ten minste één back-endpool met servers hebben.
- Standaard-listener en regel: de standaard-listener luistert naar verkeer op de poort die is toegewezen en de standaardregel verzendt verkeer naar de standaardpool.
IP-configuraties en front-endpoort maken
Koppel myAGSubnet dat u eerder hebt gemaakt aan de toepassingsgateway met behulp van New-AzApplicationGatewayIPConfiguration. Wijs myAGPublicIPAddress toe aan de toepassingsgateway met behulp van New-AzApplicationGatewayFrontendIPConfig. Maak vervolgens de HTTP-poort met new-AzApplicationGatewayFrontendPort.
# Get the virtual network and subnet references
$vnet = Get-AzVirtualNetwork `
-ResourceGroupName myResourceGroupAG `
-Name myVNet
$subnet=$vnet.Subnets[0]
# Get the public IP address
$pip = Get-AzPublicIpAddress `
-ResourceGroupName myResourceGroupAG `
-Name myAGPublicIPAddress
# Create IP configuration for the Application Gateway
$gipconfig = New-AzApplicationGatewayIPConfiguration `
-Name myAGIPConfig `
-Subnet $subnet
# Create frontend IP configuration
$fipconfig = New-AzApplicationGatewayFrontendIPConfig `
-Name myAGFrontendIPConfig `
-PublicIPAddress $pip
# Create frontend port for HTTP traffic
$frontendport = New-AzApplicationGatewayFrontendPort `
-Name myFrontendPort `
-Port 80
Write-Output "Application Gateway IP configurations created successfully"
De standaardpool en instellingen maken
Maak de standaardback-endpool met de naam appGatewayBackendPool voor de toepassingsgateway met behulp van New-AzApplicationGatewayBackendAddressPool. Configureer de instellingen voor de back-endpool met behulp van New-AzApplicationGatewayBackendHttpSettings.
# Create default backend pool
$defaultPool = New-AzApplicationGatewayBackendAddressPool `
-Name appGatewayBackendPool
# Create backend HTTP settings with optimized configuration
$poolSettings = New-AzApplicationGatewayBackendHttpSettings `
-Name myPoolSettings `
-Port 80 `
-Protocol Http `
-CookieBasedAffinity Enabled `
-RequestTimeout 120
De standaard-listener en regel maken
Een listener is vereist om de toepassingsgateway in staat te stellen verkeer op de juiste wijze naar backendpools te routeren. In deze zelfstudie maakt u meerdere listeners voor verschillende routeringsscenario's. De eerste basis-listener verwacht verkeer op de basis-URL. De andere listeners verwachten verkeer op specifieke URL-paden, zoals http://203.0.113.1:8080/images/
of http://203.0.113.1:8081/video/
.
Maak een listener met de naam defaultListener met behulp van New-AzApplicationGatewayHttpListener met de front-endconfiguratie en front-endpoort die u eerder hebt gemaakt. Er is een regel vereist voor de listener, zodat deze weet welke back-endpool voor inkomend verkeer moet worden gebruikt. Maak een basisregel met de naam rule1 met behulp van New-AzApplicationGatewayRequestRoutingRule.
# Create default HTTP listener
$defaultlistener = New-AzApplicationGatewayHttpListener `
-Name defaultListener `
-Protocol Http `
-FrontendIPConfiguration $fipconfig `
-FrontendPort $frontendport
# Create basic routing rule that directs traffic to default pool
$frontendRule = New-AzApplicationGatewayRequestRoutingRule `
-Name rule1 `
-RuleType Basic `
-HttpListener $defaultlistener `
-BackendAddressPool $defaultPool `
-BackendHttpSettings $poolSettings `
-Priority 100
Write-Output "Default listener and routing rule created successfully"
De toepassingsgateway maken
Nu u de benodigde ondersteunende resources hebt gemaakt, geeft u parameters op voor de toepassingsgateway met de naam myAppGateway met behulp van New-AzApplicationGatewaySku en maakt u deze vervolgens met behulp van New-AzApplicationGateway.
# Create SKU configuration for Application Gateway v2
$sku = New-AzApplicationGatewaySku `
-Name Standard_Medium `
-Tier Standard `
-Capacity 2
New-AzApplicationGateway `
-Name myAppGateway `
-ResourceGroupName myResourceGroupAG `
-Location eastus `
-BackendAddressPools $defaultPool `
-BackendHttpSettingsCollection $poolSettings `
-FrontendIpConfigurations $fipconfig `
-GatewayIpConfigurations $gipconfig `
-FrontendPorts $frontendport `
-HttpListeners $defaultlistener `
-RequestRoutingRules $frontendRule `
-Sku $sku
Back-endpools en back-endpoorten toevoegen
U kunt back-endpools toevoegen aan uw toepassingsgateway met behulp van Add-AzApplicationGatewayBackendAddressPool. In dit voorbeeld worden imagesBackendPool en videoBackendPool gemaakt voor het routeren van specifieke inhoudstypen. U voegt front-endpoorten toe voor de pools met behulp van Add-AzApplicationGatewayFrontendPort. Verzend de wijzigingen naar de toepassingsgateway met behulp van Set-AzApplicationGateway.
# Get the current Application Gateway configuration
$appgw = Get-AzApplicationGateway `
-ResourceGroupName myResourceGroupAG `
-Name myAppGateway
# Add specialized backend pools for different content types
Add-AzApplicationGatewayBackendAddressPool `
-ApplicationGateway $appgw `
-Name imagesBackendPool
Add-AzApplicationGatewayBackendAddressPool `
-ApplicationGateway $appgw `
-Name videoBackendPool
# Add frontend ports for specialized listeners
Add-AzApplicationGatewayFrontendPort `
-ApplicationGateway $appgw `
-Name bport `
-Port 8080
Add-AzApplicationGatewayFrontendPort `
-ApplicationGateway $appgw `
-Name rport `
-Port 8081
# Apply the configuration changes
Set-AzApplicationGateway -ApplicationGateway $appgw
Listeners en regels toevoegen
Listeners toevoegen
Voeg de listeners met de naam backendListener en redirectedListener toe die nodig zijn om verkeer te routeren met behulp van Add-AzApplicationGatewayHttpListener.
# Get the current Application Gateway configuration
$appgw = Get-AzApplicationGateway `
-ResourceGroupName myResourceGroupAG `
-Name myAppGateway
# Get frontend port references
$backendPort = Get-AzApplicationGatewayFrontendPort `
-ApplicationGateway $appgw `
-Name bport
$redirectPort = Get-AzApplicationGatewayFrontendPort `
-ApplicationGateway $appgw `
-Name rport
# Get frontend IP configuration
$fipconfig = Get-AzApplicationGatewayFrontendIPConfig `
-ApplicationGateway $appgw
# Add listeners for different ports
Add-AzApplicationGatewayHttpListener `
-ApplicationGateway $appgw `
-Name backendListener `
-Protocol Http `
-FrontendIPConfiguration $fipconfig `
-FrontendPort $backendPort
Add-AzApplicationGatewayHttpListener `
-ApplicationGateway $appgw `
-Name redirectedListener `
-Protocol Http `
-FrontendIPConfiguration $fipconfig `
-FrontendPort $redirectPort
# Apply the configuration changes
Set-AzApplicationGateway -ApplicationGateway $appgw
Toewijzing voor standaard-URL-pad toevoegen
URL-padtoewijzingen zorgen ervoor dat specifieke URL's naar specifieke back-endpools worden omgeleid. U kunt URL-padtoewijzingen maken met de naam imagePathRule en videoPathRule met behulp van New-AzApplicationGatewayPathRuleConfig en Add-AzApplicationGatewayUrlPathMapConfig.
# Get the current Application Gateway configuration
$appgw = Get-AzApplicationGateway `
-ResourceGroupName myResourceGroupAG `
-Name myAppGateway
# Get backend HTTP settings
$poolSettings = Get-AzApplicationGatewayBackendHttpSettings `
-ApplicationGateway $appgw `
-Name myPoolSettings
# Get backend address pools
$imagePool = Get-AzApplicationGatewayBackendAddressPool `
-ApplicationGateway $appgw `
-Name imagesBackendPool
$videoPool = Get-AzApplicationGatewayBackendAddressPool `
-ApplicationGateway $appgw `
-Name videoBackendPool
$defaultPool = Get-AzApplicationGatewayBackendAddressPool `
-ApplicationGateway $appgw `
-Name appGatewayBackendPool
# Create path rules for different content types
$imagePathRule = New-AzApplicationGatewayPathRuleConfig `
-Name imagePathRule `
-Paths "/images/*" `
-BackendAddressPool $imagePool `
-BackendHttpSettings $poolSettings
$videoPathRule = New-AzApplicationGatewayPathRuleConfig `
-Name videoPathRule `
-Paths "/video/*" `
-BackendAddressPool $videoPool `
-BackendHttpSettings $poolSettings
# Add URL path map configuration
Add-AzApplicationGatewayUrlPathMapConfig `
-ApplicationGateway $appgw `
-Name urlpathmap `
-PathRules $imagePathRule, $videoPathRule `
-DefaultBackendAddressPool $defaultPool `
-DefaultBackendHttpSettings $poolSettings
# Apply the configuration changes
Set-AzApplicationGateway -ApplicationGateway $appgw
Omleidingsconfiguratie toevoegen
U kunt omleiding voor de listener configureren met behulp van Add-AzApplicationGatewayRedirectConfiguration.
# Get the current Application Gateway configuration
$appgw = Get-AzApplicationGateway `
-ResourceGroupName $resourceGroupName `
-Name myAppGateway
# Get the target listener for redirection
$backendListener = Get-AzApplicationGatewayHttpListener `
-ApplicationGateway $appgw `
-Name backendListener
# Add redirection configuration with query string and path preservation
$redirectConfig = Add-AzApplicationGatewayRedirectConfiguration `
-ApplicationGateway $appgw `
-Name redirectConfig `
-RedirectType Found `
-TargetListener $backendListener `
-IncludePath $true `
-IncludeQueryString $true
# Apply the configuration changes
Set-AzApplicationGateway -ApplicationGateway $appgw
Write-Output "Redirection configuration added successfully"
Write-Output "Redirect type: HTTP 302 Found"
Write-Output "Target: backendListener (Port 8080)"
Write-Output "Preserves: Path and Query String"
Toewijzing voor het omleidings-URL-pad toevoegen
Maak een afzonderlijke URL-padtoewijzing voor omleidingsscenario's. Met deze kaart wordt verkeer op poort 8081 verwerkt en worden specifieke paden omgeleid naar de juiste listener op poort 8080.
# Get the current Application Gateway configuration
$appgw = Get-AzApplicationGateway `
-ResourceGroupName $resourceGroupName `
-Name myAppGateway
# Get references to existing configurations
$poolSettings = Get-AzApplicationGatewayBackendHttpSettings `
-ApplicationGateway $appgw `
-Name myPoolSettings
$defaultPool = Get-AzApplicationGatewayBackendAddressPool `
-ApplicationGateway $appgw `
-Name appGatewayBackendPool
$redirectConfig = Get-AzApplicationGatewayRedirectConfiguration `
-ApplicationGateway $appgw `
-Name redirectConfig
# Create path rule for redirection - images traffic will be redirected
$redirectPathRule = New-AzApplicationGatewayPathRuleConfig `
-Name redirectPathRule `
-Paths "/images/*" `
-RedirectConfiguration $redirectConfig
# Add redirection path map configuration
Add-AzApplicationGatewayUrlPathMapConfig `
-ApplicationGateway $appgw `
-Name redirectpathmap `
-PathRules $redirectPathRule `
-DefaultBackendAddressPool $defaultPool `
-DefaultBackendHttpSettings $poolSettings
# Apply the configuration changes
Set-AzApplicationGateway -ApplicationGateway $appgw
Write-Output "Redirection URL path map added successfully"
Write-Output "Redirection rule: /images/* on port 8081 -> port 8080"
Routeringsregels toevoegen
De routeringsregels koppelen de URL-toewijzingen aan de listeners die u hebt gemaakt. U kunt de regels met de naam defaultRule en redirectedRule toevoegen met behulp van Add-AzApplicationGatewayRequestRoutingRule.
$appgw = Get-AzApplicationGateway `
-ResourceGroupName myResourceGroupAG `
-Name myAppGateway
$backendlistener = Get-AzApplicationGatewayHttpListener `
-ApplicationGateway $appgw `
-Name backendListener
$redirectlistener = Get-AzApplicationGatewayHttpListener `
-ApplicationGateway $appgw `
-Name redirectedListener
$urlPathMap = Get-AzApplicationGatewayUrlPathMapConfig `
-ApplicationGateway $appgw `
-Name urlpathmap
$redirectPathMap = Get-AzApplicationGatewayUrlPathMapConfig `
-ApplicationGateway $appgw `
-Name redirectpathmap
Add-AzApplicationGatewayRequestRoutingRule `
-ApplicationGateway $appgw `
-Name defaultRule `
-RuleType PathBasedRouting `
-HttpListener $backendlistener `
-UrlPathMap $urlPathMap
Add-AzApplicationGatewayRequestRoutingRule `
-ApplicationGateway $appgw `
-Name redirectedRule `
-RuleType PathBasedRouting `
-HttpListener $redirectlistener `
-UrlPathMap $redirectPathMap
Set-AzApplicationGateway -ApplicationGateway $appgw
Virtuele-machineschaalset maken
In dit voorbeeld maakt u drie virtuele-machineschaalsets die ondersteuning bieden voor de drie back-endpools die u hebt gemaakt. De schaalsets hebben de naam myvmss1, myvmss2 en myvmss3. Elke schaalset bevat twee exemplaren van virtuele machines waarop u IIS installeert. U wijst de schaalset toe aan de back-endpool wanneer u de IP-instellingen configureert.
Belangrijk
Vervang <username>
en <password>
door uw eigen waarden voordat u het script uitvoert. Gebruik een sterk wachtwoord dat voldoet aan de beveiligingsvereisten van Azure.
Beveiligingsnotitie: vervang <username>
en <password>
door beveiligde referenties. Overweeg om Azure Key Vault te gebruiken voor referentiebeheer in productiescenario's.
# Get network and Application Gateway references
$vnet = Get-AzVirtualNetwork `
-ResourceGroupName myResourceGroupAG `
-Name myVNet
$appgw = Get-AzApplicationGateway `
-ResourceGroupName myResourceGroupAG `
-Name myAppGateway
# Get backend pool references
$backendPool = Get-AzApplicationGatewayBackendAddressPool `
-Name appGatewayBackendPool `
-ApplicationGateway $appgw
$imagesPool = Get-AzApplicationGatewayBackendAddressPool `
-Name imagesBackendPool `
-ApplicationGateway $appgw
$videoPool = Get-AzApplicationGatewayBackendAddressPool `
-Name videoBackendPool `
-ApplicationGateway $appgw
# Create three scale sets with improved configuration
for ($i=1; $i -le 3; $i++)
{
if ($i -eq 1)
{
$poolId = $backendPool.Id
}
if ($i -eq 2)
{
$poolId = $imagesPool.Id
}
if ($i -eq 3)
{
$poolId = $videoPool.Id
}
$ipConfig = New-AzVmssIpConfig `
-Name myVmssIPConfig$i `
-SubnetId $vnet.Subnets[1].Id `
-ApplicationGatewayBackendAddressPoolsId $poolId
# Create scale set configuration with modern VM size and settings
$vmssConfig = New-AzVmssConfig `
-Location eastus `
-SkuCapacity 2 `
-SkuName Standard_DS2 `
-UpgradePolicyMode Automatic
# Configure storage profile with Windows Server 2022
Set-AzVmssStorageProfile $vmssConfig `
-ImageReferencePublisher MicrosoftWindowsServer `
-ImageReferenceOffer WindowsServer `
-ImageReferenceSku 2016-Datacenter `
-ImageReferenceVersion latest `
-OsDiskCreateOption FromImage
Set-AzVmssOsProfile $vmssConfig `
-AdminUsername <username> `
-AdminPassword "<password>" `
-ComputerNamePrefix myvmss$i
# Add network interface configuration
Add-AzVmssNetworkInterfaceConfiguration `
-VirtualMachineScaleSet $vmssConfig `
-Name myVmssNetConfig$i `
-Primary $true `
-IPConfiguration $ipConfig
New-AzVmss `
-ResourceGroupName myResourceGroupAG `
-Name myvmss$i `
-VirtualMachineScaleSet $vmssConfig
Write-Output "Virtual Machine Scale Set myvmss$i created successfully"
}
Write-Output "All Virtual Machine Scale Sets created successfully"
IIS installeren
Met het volgende script wordt IIS op de virtuele machines in elke schaalset geïnstalleerd en geconfigureerd om verschillende inhoud weer te geven op basis van de back-endpool die ze bedienen.
$publicSettings = @{ "fileUris" = (,"https://raw.githubusercontent.com/Azure/azure-docs-powershell-samples/master/application-gateway/iis/appgatewayurl.ps1");
"commandToExecute" = "powershell -ExecutionPolicy Unrestricted -File appgatewayurl.ps1" }
# Install IIS on all scale sets
for ($i=1; $i -le 3; $i++)
{
$vmss = Get-AzVmss -ResourceGroupName myResourceGroupAG -VMScaleSetName myvmss$i
Add-AzVmssExtension -VirtualMachineScaleSet $vmss `
-Name "customScript" `
-Publisher "Microsoft.Compute" `
-Type "CustomScriptExtension" `
-TypeHandlerVersion 1.8 `
-Setting $publicSettings
Update-AzVmss `
-ResourceGroupName myResourceGroupAG `
-Name myvmss$i `
-VirtualMachineScaleSet $vmss
}
De toepassingsgateway testen
Hoewel IIS niet vereist is om de toepassingsgateway te maken, hebt u deze in deze zelfstudie geïnstalleerd om te controleren of Azure de toepassingsgateway heeft gemaakt. Gebruik IIS om de toepassingsgateway te testen:
Voer Get-AzPublicIPAddress uit om het openbare IP-adres van de toepassingsgateway op te halen:
Get-AzPublicIPAddress -ResourceGroupName myResourceGroupAG -Name myAGPublicIPAddress
Kopieer het openbare IP-adres en plak het in de adresbalk van de browser. Voorbeeld:
-
http://203.0.113.1
(basis-URL) -
http://203.0.113.1:8080/images/test.htm
(pad naar afbeeldingen) -
http://203.0.113.1:8080/video/test.htm
(videopad) -
http://203.0.113.1:8081/images/test.htm
(omleidingstest)
-
Wijzig de URL in http://<ip-address>:8080/images/test.htm
, vervang uw IP-adres voor <ip-address>
en u ziet er ongeveer als volgt uit:
Wijzig de URL in http://<ip-address>:8080/video/test.htm
, vervang uw IP-adres voor <ip-address>
en u ziet er ongeveer als volgt uit:
Wijzig nu de URL in http://<ip-address>:8081/images/test.htm
, vervang uw IP-adres door <ip-address>
, en u ziet dat het verkeer wordt omgeleid naar de back-endpool van de afbeeldingen op http://<ip-address>:8080/images
.
Prestatiemeting
Bewaak de belangrijkste metrische gegevens van Application Gateway voor optimale prestaties:
- Aantal aanvragen: totaal aantal verwerkte aanvragen
- Reactietijd: gemiddelde reactietijd voor aanvragen
- Aantal ongezonde hosts: aantal ongezonde backendservers
- Doorvoer: Snelheid van gegevensoverdracht via Application Gateway
Resources opschonen
Wanneer u de resourcegroep, toepassingsgateway en alle gerelateerde resources niet meer nodig hebt, verwijdert u deze met remove-AzResourceGroup.
Remove-AzResourceGroup -Name myResourceGroupAG
Volgende stappen
Nu u een omleiding op basis van URL-pad met Application Gateway hebt geleerd, verkent u deze geavanceerde scenario's: