Skip to content

Commit 98da355

Browse files
authored
Revise migration script documentation
Updated the migration script documentation for clarity and added detailed parameter descriptions. Signed-off-by: MJyot <[email protected]>
1 parent eae9d49 commit 98da355

1 file changed

Lines changed: 52 additions & 47 deletions

File tree

articles/application-gateway/migrate-v1-v2.md

Lines changed: 52 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -125,80 +125,86 @@ This is the older cloning script, which facilitates the transition by:
125125
* Creating a new Standard_V2 or WAF_V2 Application Gateway in a user-specified virtual network subnet.
126126
* Automatically copying the configuration from an existing Standard or WAF V1 gateway to the newly created V2 gateway.
127127
* Requires customer to provide SSL and auth certs as input and doesn't support private only V2 gateways
128-
129128
You can **download** this cloning script from the [PowerShell Gallery](https://www.powershellgallery.com/packages/AzureAppGWMigration)
130129

131-
### How to run the script
132-
To run the script:
133-
1. Use `Connect-AzAccount` to connect to Azure.
134-
2. Use `Import-Module Az` to import the Az modules.
135-
3. Run the `Set-AzContext` cmdlet, to set the active Azure context to the correct subscription. This is an important step because the migration script might clean up the existing resource group if it doesn't exist in current subscription context.
136-
```
137-
Set-AzContext -Subscription '<V1 application gateway SubscriptionId>'
138-
```
139-
4. Install the script by following the steps-[Install Script](../application-gateway/migrate-v1-v2.md#installing-the-script)
140-
5. Run `Get-Help AzureAppGWMigration.ps1` to examine the required parameters:
141-
142130
**Parameters for the script:**
143-
144131
The legacy script takes below parameters:
145132

146-
* **resourceId: [String]: Required**: This parameter is the Azure Resource ID for your existing Standard V1 or WAF V1 gateway. To find this string value, navigate to the Azure portal, select your application gateway or WAF resource, and click the **Properties** link for the gateway. The Resource ID is located on that page.
133+
* **resourceId: [String]: Required**: This parameter is the Azure Resource ID for your existing Standard V1 or WAF V1 gateway. To find this string value, navigate to the Azure portal, select your application gateway or WAF resource, and click the **Properties** link for the gateway. The Resource ID is located on that page.
147134
You can also run the following Azure PowerShell commands to get the Resource ID:
148135
```azurepowershell
149136
$appgw = Get-AzApplicationGateway -Name <V1 gateway name> -ResourceGroupName <resource group Name>
150137
$appgw.Id
151138
```
152139
* **subnetAddressRange: [String]: Required**: This parameter is the IP address space that you've allocated (or want to allocate) for a new subnet that contains your new V2 gateway. The address space must be specified in the CIDR notation. For example: 10.0.0.0/24. You don't need to create this subnet in advance but the CIDR needs to be part of the VNET address space. The script creates it for you if it doesn't exist and if it exists, it uses the existing one (make sure the subnet is either empty, contains only V2 Gateway if any, and has enough available IPs).
153140
* **appgwName: [String]: Optional**. This is a string you specify to use as the name for the new Standard_V2 or WAF_V2 gateway. If this parameter isn't supplied, the name of your existing V1 gateway is used with the suffix *_V2* appended.
154-
* * **AppGWResourceGroupName: [String]: Optional**. Name of resource group where you want V2 Application Gateway resources to be created (default value is `<V1-app-gw-rgname>`)
141+
* **AppGWResourceGroupName: [String]: Optional**. Name of resource group where you want V2 Application Gateway resources to be created (default value is `<V1-app-gw-rgname>`)
155142
156-
> [!NOTE]
143+
> [!NOTE]
157144
> Ensure that there's no existing Application gateway with the provided AppGW V2 Name and Resource group name in V1 subscription. This rewrites the existing resources.
145+
158146
159147
* **sslCertificates: [PSApplicationGatewaySslCertificate]: Optional**. A comma-separated list of PSApplicationGatewaySslCertificate objects that you create to represent the TLS/SSL certs from your V1 gateway must be uploaded to the new V2 gateway. For each of your TLS/SSL certs configured for your Standard V1 or WAF V1 gateway, you can create a new PSApplicationGatewaySslCertificate object via the `New-AzApplicationGatewaySslCertificate` command shown here. You need the path to your TLS/SSL Cert file and the password.
148+
160149
This parameter is only optional if you don't have HTTPS listeners configured for your V1 gateway or WAF. If you have at least one HTTPS listener setup, you must specify this parameter.
161-
```azurepowershell
150+
```azurepowershell
162151
$password = ConvertTo-SecureString <cert-password> -AsPlainText -Force
163152
$mySslCert1 = New-AzApplicationGatewaySslCertificate -Name "Cert01" `
164153
-CertificateFile <Cert-File-Path-1> `
165154
Password $password
166155
$mySslCert2 = New-AzApplicationGatewaySslCertificate -Name "Cert02" `
167156
-CertificateFile <Cert-File-Path-2> `
168157
-Password $password
169-
```
170-
You can pass in `$mySslCert1, $mySslCert2` (comma-separated) in the previous example as values for this parameter in the script.
171-
* **sslCertificates from Keyvault: Optional**. You can download the certificates stored in Azure Key Vault and pass it to migration script. To download the certificate as a PFX file, run following command. These commands access SecretId, and then save the content as a PFX file.
172-
```azurepowershell
173-
$vaultName = ConvertTo-SecureString <kv-name> -AsPlainText -Force
174-
$certificateName = ConvertTo-SecureString <cert-name> -AsPlainText -Force
175-
$password = ConvertTo-SecureString <password> -AsPlainText -Force
176-
$pfxSecret = Get-AzKeyVaultSecret -VaultName $vaultName -Name $certificateName -AsPlainText
177-
$secretByte = [Convert]::FromBase64String($pfxSecret)
178-
$x509Cert = New-Object Security.Cryptography.X509Certificates.X509Certificate2
179-
$x509Cert.Import($secretByte, $null, [Security.Cryptography.X509Certificates.X509KeyStorageFlags]::Exportable)
180-
$pfxFileByte = $x509Cert.Export([Security.Cryptography.X509Certificates.X509ContentType]::Pkcs12, $password)
181-
# Write to a file
182-
[IO.File]::WriteAllBytes("KeyVaultcertificate.pfx", $pfxFileByte)
158+
```
159+
You can pass in `$mySslCert1, $mySslCert2` (comma-separated) in the previous example as values for this parameter in the script.
160+
161+
* **sslCertificates from Keyvault: Optional**. You can download the certificates stored in Azure Key Vault and pass it to migration script. To download the certificate as a PFX file, run following command.
162+
These comma nds access SecretId, and then save the content as a PFX file.
163+
```azurepowershell
164+
$vaultName = ConvertTo-SecureString <kv-name> -AsPlainText -Force
165+
$certificateName = ConvertTo-SecureString <cert-name> -AsPlainText -Force
166+
$password = ConvertTo-SecureString <password> -AsPlainText -Force
167+
$pfxSecret = Get-AzKeyVaultSecret -VaultName $vaultName -Name $certificateName -AsPlainText
168+
$secretByte = [Convert]::FromBase64String($pfxSecret)
169+
$x509Cert = New-Object Security.Cryptography.X509Certificates.X509Certificate2
170+
$x509Cert.Import($secretByte, $null, [Security.Cryptography.X509Certificates.X509KeyStorageFlags]::Exportable)
171+
$pfxFileByte = $x509Cert.Export([Security.Cryptography.X509Certificates.X509ContentType]::Pkcs12, $password)
172+
# Write to a file
173+
[IO.File]::WriteAllBytes("KeyVaultcertificate.pfx", $pfxFileByte)
183174
```
184-
185-
For each of the cert downloaded from the Keyvault, you can create a new PSApplicationGatewaySslCertificate object via the New-AzApplicationGatewaySslCertificate command shown here. You need the path to your TLS/SSL Cert file and the password.
186-
```azurepowershell
187-
//Convert the downloaded certificate to SSL object
188-
$password = ConvertTo-SecureString <password> -AsPlainText -Force
189-
$cert = New-AzApplicationGatewaySSLCertificate -Name <certname> -CertificateFile <Cert-File-Path-1> -Password $password
190-
```
191-
* **trustedRootCertificates: [PSApplicationGatewayTrustedRootCertificate]: Optional**. A comma-separated list of PSApplicationGatewayTrustedRootCertificate objects that you create to represent the [Trusted Root certificates](ssl-overview.md) for authentication of your backend instances from your v2 gateway.
192-
```azurepowershell
193-
$certFilePath = ".\rootCA.cer"
194-
$trustedCert = New-AzApplicationGatewayTrustedRootCertificate -Name "trustedCert1" -CertificateFile $certFilePath
195-
```
196-
To create a list of PSApplicationGatewayTrustedRootCertificate objects, see [New-AzApplicationGatewayTrustedRootCertificate](/powershell/module/Az.Network/New-AzApplicationGatewayTrustedRootCertificate).
175+
For each of the cert downloaded from the Keyvault, you can create a new PSApplicationGatewaySslCertificate object via the New-AzApplicationGatewaySslCertificate command shown here. You need the path to your TLS/SSL Cert file and the password.
176+
```azurepowershell
177+
//Convert the downloaded certificate to SSL object
178+
$password = ConvertTo-SecureString <password> -AsPlainText -Force
179+
$cert = New-AzApplicationGatewaySSLCertificate -Name <certname> -CertificateFile <Cert-File-Path-1> -Password $password
180+
```
181+
* **trustedRootCertificates: [PSApplicationGatewayTrustedRootCertificate]: Optional**. A comma-separated list of PSApplicationGatewayTrustedRootCertificate objects that you create to represent the [Trusted Root certificates](ssl-overview.md) for authentication of your backend instances from your v2 gateway.
182+
```azurepowershell
183+
$certFilePath = ".\rootCA.cer"
184+
$trustedCert = New-AzApplicationGatewayTrustedRootCertificate -Name "trustedCert1" -CertificateFile $certFilePath
185+
```
186+
To create a list of PSApplicationGatewayTrustedRootCertificate objects, see [New-AzApplicationGatewayTrustedRootCertificate](/powershell/module/Az.Network/New-AzApplicationGatewayTrustedRootCertificate).
187+
197188
* **privateIpAddress: [String]: Optional**. A specific private IP address that you want to associate to your new V2 gateway. This must be from the same VNet that you allocate for your new V2 gateway. If this isn't specified, the script allocates a private IP address for your V2 gateway.
189+
198190
* **publicIpResourceId: [String]: Optional**. The resourceId of existing public IP address (standard SKU) resource in your subscription that you want to allocate to the new V2 gateway. If public Ip resource name is provided, ensure that it exists in succeeded state.
199-
If this isn't specified, the script allocates a new public IP address in the same resource group. The name is the V2 gateway's name with *-IP* appended. If AppGWResourceGroupName is provided and a public IP address isn't provided, ensure that public IP resource with name AppGWV2Name-IP doesn’t exist in a resource group with the name AppGWResourceGroupName in the V1 subscription.
200-
* **validateMigration: [switch]: Optional**. Use this parameter to enable the script to do some basic configuration comparison validations after the V2 gateway creation and the configuration copy. By default, no validation is done.
191+
If this isn't specified, the script allocates a new public IP address in the same resource group. The name is the V2 gateway's name with *-IP* appended. If AppGWResourceGroupName is provided and a public IP address isn't provided, ensure that public IP resource with name AppGWV2Name-IP doesn’t exist in a resource group with the name AppGWResourceGroupName in the V1 subscription.
192+
193+
* **validateMigration: [switch]: Optional**. Use this parameter to enable the script to do some basic configuration comparison validations after the V2 gateway creation and the configuration copy. By default, no validation is done.
194+
201195
* **enableAutoScale: [switch]: Optional**. Use this parameter to enable the script to enable autoscaling on the new V2 gateway after it's created. By default, autoscaling is disabled. You can always manually enable it later on the newly created V2 gateway.
196+
197+
### How to run the script
198+
199+
To run the script:
200+
1. Use `Connect-AzAccount` to connect to Azure.
201+
2. Use `Import-Module Az` to import the Az modules.
202+
3. Run the `Set-AzContext` cmdlet, to set the active Azure context to the correct subscription. This is an important step because the migration script might clean up the existing resource group if it doesn't exist in current subscription context.
203+
```
204+
Set-AzContext -Subscription '<V1 application gateway SubscriptionId>'
205+
```
206+
4. Install the script by following the steps-[Install Script](../application-gateway/migrate-v1-v2.md#installing-the-script)
207+
5. Run `Get-Help AzureAppGWMigration.ps1` to examine the required parameters:
202208
6. Run the script using the appropriate parameters. It may take five to seven minutes to finish.
203209
```
204210
AzureAppGWMigration.ps1
@@ -212,7 +218,6 @@ The legacy script takes below parameters:
212218
-publicIpResourceId <public IP name string>
213219
-validateMigration -enableAutoScale
214220
```
215-
216221
**Example**
217222
```azurepowershell
218223
AzureAppGWMigration.ps1 `

0 commit comments

Comments
 (0)