Skip to content

Commit a44ee55

Browse files
Merge pull request #252317 from simonkurtz-MSFT/patch-1
Consolidate variables
2 parents 5a0923e + 216cb43 commit a44ee55

File tree

1 file changed

+38
-25
lines changed

1 file changed

+38
-25
lines changed

articles/api-management/api-management-howto-integrate-internal-vnet-appgateway.md

Lines changed: 38 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,40 @@ If you use Azure Active Directory or third-party authentication, enable the [coo
8282
> - `920300`, `920330`, `931130`, `942100`, `942110`, `942180`, `942200`, `942260`, `942340`, `942370` for the administrative mode
8383
> - `942200`, `942260`, `942370`, `942430`, `942440` for the published portal
8484
85+
## Setting Variables
86+
87+
Throughout this guide, you will need to define several variables.
88+
89+
```powershell
90+
# These variables must be changed.
91+
$subscriptionId = "00000000-0000-0000-0000-000000000000" # GUID of your Azure subscription
92+
$domain = "contoso.net" # The custom domain for your certificate
93+
$apimServiceName = "ContosoApi" # API Management service instance name, must be globally unique
94+
$apimDomainNameLabel = $apimServiceName # Domain name label for API Management's public IP address, must be globally unique
95+
$apimAdminEmail = "[email protected]" # Administrator's email address - use your email address
96+
97+
$gatewayHostname = "api.$domain" # API gateway host
98+
$portalHostname = "portal.$domain" # API developer portal host
99+
$managementHostname = "management.$domain" # API management endpoint host
100+
101+
$baseCertPath = "C:\Users\Contoso\" # The base path where all certificates are stored
102+
$trustedRootCertCerPath = "${baseCertPath}trustedroot.cer" # Full path to contoso.net trusted root .cer file
103+
$gatewayCertPfxPath = "${baseCertPath}gateway.pfx" # Full path to api.contoso.net .pfx file
104+
$portalCertPfxPath = "${baseCertPath}portal.pfx" # Full path to portal.contoso.net .pfx file
105+
$managementCertPfxPath = "${baseCertPath}management.pfx" # Full path to management.contoso.net .pfx file
106+
107+
$gatewayCertPfxPassword = "certificatePassword123" # Password for api.contoso.net pfx certificate
108+
$portalCertPfxPassword = "certificatePassword123" # Password for portal.contoso.net pfx certificate
109+
$managementCertPfxPassword = "certificatePassword123" # Password for management.contoso.net pfx certificate
110+
111+
112+
# These variables may be changed.
113+
$resGroupName = "apim-appGw-RG" # Resource group name that will hold all assets
114+
$location = "West US" # Azure region that will hold all assets
115+
$apimOrganization = "Contoso" # Organization name
116+
$appgwName = "apim-app-gw" # The name of the Application Gateway
117+
```
118+
85119
## Create a resource group for Resource Manager
86120

87121
To create a resource group for Azure Resource Manager:
@@ -96,16 +130,13 @@ To create a resource group for Azure Resource Manager:
96130
97131
1. Select the subscription you want.
98132
99-
```powershell
100-
$subscriptionId = "00000000-0000-0000-0000-000000000000" # GUID of your Azure subscription
133+
```powershell
101134
Get-AzSubscription -Subscriptionid $subscriptionId | Select-AzSubscription
102135
```
103136
104137
1. Create a resource group. You can skip this step if you're using an existing resource group.
105138
106-
```powershell
107-
$resGroupName = "apim-appGw-RG" # resource group name
108-
$location = "West US" # Azure region
139+
```powershell
109140
New-AzResourceGroup -Name $resGroupName -Location $location
110141
```
111142
@@ -183,7 +214,7 @@ The following example shows how to create an API Management instance in a virtua
183214
184215
```powershell
185216
$apimPublicIpAddressId = New-AzPublicIpAddress -ResourceGroupName $resGroupName -name "pip-apim" -location $location `
186-
-AllocationMethod Static -Sku Standard -Force -DomainNameLabel "apim-contoso"
217+
-AllocationMethod Static -Sku Standard -Force -DomainNameLabel $apimDomainNameLabel
187218
```
188219
189220
1. Create an API Management virtual network object by using the subnet `$apimSubnetData` you created.
@@ -195,11 +226,6 @@ The following example shows how to create an API Management instance in a virtua
195226
1. Create an API Management instance inside the virtual network. This example creates the service in the Developer service tier. Substitute a unique name for your API Management instance.
196227
197228
```powershell
198-
$domain = "contoso.net"
199-
$apimServiceName = "ContosoApi" # API Management service instance name, must be globally unique
200-
$apimOrganization = "Contoso" # Organization name
201-
$apimAdminEmail = "[email protected]" # Administrator's email address
202-
203229
$apimService = New-AzApiManagement -ResourceGroupName $resGroupName -Location $location -Name $apimServiceName -Organization $apimOrganization `
204230
-AdminEmail $apimAdminEmail -VirtualNetwork $apimVirtualNetwork -VpnType "Internal" -Sku "Developer" -PublicIpAddressId $apimPublicIpAddressId.Id
205231
```
@@ -213,18 +239,6 @@ To set up custom domain names in API Management:
213239
1. Initialize the following variables with the details of the certificates with private keys for the domains and the trusted root certificate. In this example, we use `api.contoso.net`, `portal.contoso.net`, and `management.contoso.net`.
214240
215241
```powershell
216-
$gatewayHostname = "api.$domain" # API gateway host
217-
$portalHostname = "portal.$domain" # API developer portal host
218-
$managementHostname = "management.$domain" # API management endpoint host
219-
$gatewayCertPfxPath = "C:\Users\Contoso\gateway.pfx" # Full path to api.contoso.net .pfx file
220-
$portalCertPfxPath = "C:\Users\Contoso\portal.pfx" # Full path to portal.contoso.net .pfx file
221-
$managementCertPfxPath = "C:\Users\Contoso\management.pfx" # Full path to management.contoso.net .pfx file
222-
$gatewayCertPfxPassword = "certificatePassword123" # Password for api.contoso.net pfx certificate
223-
$portalCertPfxPassword = "certificatePassword123" # Password for portal.contoso.net pfx certificate
224-
$managementCertPfxPassword = "certificatePassword123" # Password for management.contoso.net pfx certificate
225-
# Path to trusted root CER file used in Application Gateway HTTP settings
226-
$trustedRootCertCerPath = "C:\Users\Contoso\trustedroot.cer" # Full path to contoso.net trusted root .cer file
227-
228242
$certGatewayPwd = ConvertTo-SecureString -String $gatewayCertPfxPassword -AsPlainText -Force
229243
$certPortalPwd = ConvertTo-SecureString -String $portalCertPfxPassword -AsPlainText -Force
230244
$certManagementPwd = ConvertTo-SecureString -String $managementCertPfxPassword -AsPlainText -Force
@@ -435,8 +449,7 @@ To create an Application Gateway resource:
435449
436450
1. Create an application gateway with all the configuration objects from the preceding steps.
437451
438-
```powershell
439-
$appgwName = "apim-app-gw"
452+
```powershell
440453
$appgw = New-AzApplicationGateway -Name $appgwName -ResourceGroupName $resGroupName -Location $location `
441454
-BackendAddressPools $apimGatewayBackendPool,$apimPortalBackendPool,$apimManagementBackendPool `
442455
-BackendHttpSettingsCollection $apimPoolGatewaySetting, $apimPoolPortalSetting, $apimPoolManagementSetting `

0 commit comments

Comments
 (0)