适用于: ✔️ Front Door (经典)
Azure Front Door 标准和高级层为 Azure 带来了最新的云分发网络功能。 通过增强的安全功能和一体化服务,您可以保护应用内容,并通过Microsoft全球网络将其更贴近终端用户。 本文将指导您完成迁移过程,并通过使用 Azure PowerShell 将 Azure Front Door(经典)配置文件迁移到标准层或高级层配置文件之一。
先决条件
- 请阅读关于 Front Door 分层迁移一文。
- 确保可以迁移 Front Door(经典)配置文件:
- Azure Front Door 标准层和高级层要求所有自定义域都使用 HTTPS。 如果你没有自己的证书,可以使用 Azure Front Door 管理的证书。 证书是免费的,由Azure帮你管理。
- 在 Azure Front Door 标准或高级配置文件的源组设置中启用会话亲和性。 在 Azure Front Door(经典)中,在域级别设置会话亲和性。 作为迁移的一部分,会话亲和性基于 Front Door(经典)配置文件设置。 如果你的经典配置文件中有两个共享同一个后端池(起源组)的域名,会话亲和性必须在两个域之间保持一致,迁移验证才会通过。
- 最新的 Azure PowerShell 模块(本地安装)或 Azure Cloud Shell。 有关详细信息,请参阅安装和配置 Azure PowerShell。
注意
无需在迁移过程之前或迁移过程中进行任何 DNS 更改。 但是,一旦迁移完成并且流量开始通过你新的 Azure Front Door 配置文件传输,你就需要更新 DNS 记录。 更多信息请参见 迁移后端点切换。
验证兼容性
打开 Azure PowerShell 并连接到 Azure 帐户。 有关详细信息,请参阅连接到 Azure PowerShell。
测试 Azure Front Door(经典)配置文件,看看它是否与迁移兼容。 使用 Test-AzFrontDoorCdnProfileMigration 命令来测试配置文件。 将资源组名称和资源 ID 的值替换为自己的值。 使用 Get-AzFrontDoor 获取 Front Door(经典)配置文件的资源 ID。
替换命令中的以下值:
-
<subscriptionId>:订阅 ID。
-
<resourceGroupName>:Front Door(经典)的资源组名称。
-
<frontdoorClassicName>:Front Door(经典)配置文件的名称。
Test-AzFrontDoorCdnProfileMigration -ResourceGroupName <resourceGroupName> -ClassicResourceReferenceId /subscriptions/<subscriptionId>/resourcegroups/<resourceGroupName>/providers/Microsoft.Network/frontdoors/<frontdoorClassicName>
如果迁移兼容,你会看到以下输出:
CanMigrate DefaultSku
---------- ----------
True Standard_AzureFrontDoor or Premium_AzureFrontDoor
如果迁移不兼容,则会看到以下输出:
CanMigrate DefaultSku
---------- ----------
False
准备迁移
注意
- 目前 Azure Front Door Standard 或 Premium 在 Azure 政府 Cloud 中不支持 Managed 证书。 需要对 Azure 政府云中的 Azure Front Door 标准版或高级版使用 BYOC,或者等待此功能可用。
运行 Start-AzFrontDoorCdnProfilePrepareMigration 命令以准备迁移。 用你自己的值替换资源组名称、资源ID和配置文件名称的值。 对于 SkuName,请使用 Standard_AzureFrontDoor 或 Premium_AzureFrontDoor。
SkuName 基于 Test-AzFrontDoorCdnProfileMigration 命令的输出。
替换命令中的以下值:
-
<subscriptionId>:订阅 ID。
-
<resourceGroupName>:Front Door(经典)的资源组名称。
-
<frontdoorClassicName>:Front Door(经典)配置文件的名称。
Start-AzFrontDoorCdnProfilePrepareMigration -ResourceGroupName <resourceGroupName> -ClassicResourceReferenceId /subscriptions/<subscriptionId>/resourcegroups/<resourceGroupName>/providers/Microsoft.Network/frontdoors/<frontdoorClassicName> -ProfileName myAzureFrontDoor -SkuName Premium_AzureFrontDoor
输出与下面类似:
Starting the parameter validation process.
The parameters are successfully validated.
Your new Front Door profile is being created. Wait until the process finishes. This process might take several minutes.
Your new Front Door profile with the configuration is successfully created.
运行 Get-AzFrontDoorWafPolicy 命令以获取 WAF 策略的资源 ID。 将资源组名称和 WAF 策略名称的值替换为自己的值。
Get-AzFrontDoorWafPolicy -ResourceGroupName myAFDResourceGroup -Name myClassicFrontDoorWAF
输出与下面类似:
PolicyMode : Detection
PolicyEnabledState : Enabled
RedirectUrl :
CustomBlockResponseStatusCode : 403
CustomBlockResponseBody :
RequestBodyCheck : Disabled
CustomRules : {}
ManagedRules : {Microsoft.Azure.Commands.FrontDoor.Models.PSAzureManagedRule}
Etag :
ProvisioningState : Succeeded
Sku : Classic_AzureFrontDoor
Tags :
Id : /subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourcegroups/myAFDResourceGroup/providers/Microsoft.Network/frontdoorwebapplicationfirewallpolicies/myClassicFrontDoorWAF
Name : myFrontDoorWAF
Type :
运行 New-AzFrontDoorCdnMigrationWebApplicationFirewallMappingObject 命令为 WAF 策略迁移创建内存中的对象。 在 MigratedFromId 的最后一步中使用 WAF ID。 若要使用现有 WAF 策略,请将 MigratedToId 的值替换为与要迁移到的 Front Door 层匹配的 WAF 策略的资源 ID。 如果创建新的 WAF 策略副本,可以在资源 ID 中更改 WAF 策略的名称。
$wafMapping = New-AzFrontDoorCdnMigrationWebApplicationFirewallMappingObject -MigratedFromId /subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourcegroups/myAFDResourceGroup/providers/Microsoft.Network/frontdoorwebapplicationfirewallpolicies/myClassicFrontDoorWAF -MigratedToId /subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourcegroups/myAFDResourceGroup/providers/Microsoft.Network/frontdoorwebapplicationfirewallpolicies/myFrontDoorWAF
运行 Start-AzFrontDoorCdnProfilePrepareMigration 命令以准备迁移。 将资源组名称、资源 ID 和配置文件名称的值替换为自己的值。 对于 SkuName,请使用 Standard_AzureFrontDoor 或 Premium_AzureFrontDoor。
SkuName 基于 Test-AzFrontDoorCdnProfileMigration 命令的输出。
替换命令中的以下值:
-
<subscriptionId>:订阅 ID。
-
<resourceGroupName>:Front Door(经典)的资源组名称。
-
<frontdoorClassicName>:Front Door(经典)配置文件的名称。
Start-AzFrontDoorCdnProfilePrepareMigration -ResourceGroupName <resourceGroupName> -ClassicResourceReferenceId /subscriptions/<subscriptionId>/resourcegroups/<resourceGroupName>/providers/Microsoft.Network/frontdoors/<frontdoorClassicName> -ProfileName myAzureFrontDoor -SkuName Premium_AzureFrontDoor -MigrationWebApplicationFirewallMapping $wafMapping
输出与下面类似:
Starting the parameter validation process.
The parameters are successfully validated.
Your new Front Door profile is being created. Wait until the process finishes. This process might take several minutes.
Your new Front Door profile with the configuration is successfully created.
如果要使用 BYOC 迁移 Front Door 配置文件,则需要在 Front Door 配置文件上启用托管标识。 需要将 Front Door 配置文件的访问权限授予给存储证书的密钥保管库。
运行 Start-AzFrontDoorCdnProfilePrepareMigration 命令以准备迁移。 用你自己的值替换资源组名称、资源ID和配置文件名称的值。 对于 SkuName,请使用 Standard_AzureFrontDoor 或 Premium_AzureFrontDoor。
SkuName 基于 Test-AzFrontDoorCdnProfileMigration 命令的输出。
系统分配
对于 IdentityType,请使用 SystemAssigned。
Start-AzFrontDoorCdnProfilePrepareMigration -ResourceGroupName myAFDResourceGroup -ClassicResourceReferenceId /subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourcegroups/myAFDResourceGroup/providers/Microsoft.Network/Frontdoors/myAzureFrontDoorClassic -ProfileName myAzureFrontDoor -SkuName Premium_AzureFrontDoor -IdentityType SystemAssigned
用户已被分配
运行 Get-AzUserAssignedIdentity 命令获取用户分配标识的资源 ID。
$id = Get-AzUserAssignedIdentity -ResourceGroupName myResourceGroup -Name afduseridentity
$id.Id
输出与下面类似:
/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourcegroups/myAFDResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/afduseridentity
对于 IdentityType,使用 UserAssigned;对于 IdentityUserAssignedIdentity,*使用上一步中的资源 ID。
替换命令中的以下值:
-
<subscriptionId>:订阅 ID。
-
<resourceGroupName>:Front Door(经典)的资源组名称。
-
<frontdoorClassicName>:Front Door(经典)配置文件的名称。
Start-AzFrontDoorCdnProfilePrepareMigration -ResourceGroupName <resourceGroupName> -ClassicResourceReferenceId /subscriptions/<subscriptionId>/resourcegroups/<resourceGroupName>/providers/Microsoft.Network/frontdoors/<frontdoorClassicName> -ProfileName myAzureFrontDoor -SkuName Premium_AzureFrontDoor -IdentityType UserAssigned -IdentityUserAssignedIdentity @{"/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/afduseridentity" = @{}}
输出与下面类似:
Starting the parameter validation process.
The parameters are successfully validated.
Your new Front Door profile is being created. Wait until the process finishes. This process might take several minutes.
Your new Front Door profile with the configuration is successfully created.
此示例显示如何使用多个 WAF 策略迁移 Front Door 配置文件,并启用系统分配和用户分配的标识。
运行 Get-AzFrontDoorWafPolicy 命令以获取 WAF 策略的资源 ID。 将资源组名称和 WAF 策略名称的值替换为自己的值。
Get-AzFrontDoorWafPolicy -ResourceGroupName myAFDResourceGroup -Name myClassicFrontDoorWAF
输出与下面类似:
PolicyMode : Detection
PolicyEnabledState : Enabled
RedirectUrl :
CustomBlockResponseStatusCode : 403
CustomBlockResponseBody :
RequestBodyCheck : Disabled
CustomRules : {}
ManagedRules : {Microsoft.Azure.Commands.FrontDoor.Models.PSAzureManagedRule}
Etag :
ProvisioningState : Succeeded
Sku : Classic_AzureFrontDoor
Tags :
Id : /subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourcegroups/myAFDResourceGroup/providers/Microsoft.Network/frontdoorwebapplicationfirewallpolicies/myClassicFrontDoorWAF
Name : myFrontDoorWAF
Type :
运行 New-AzFrontDoorCdnMigrationWebApplicationFirewallMappingObject 命令为 WAF 策略迁移创建内存中的对象。 在 MigratedFromId 的最后一步中使用 WAF ID。 若要使用现有 WAF 策略,请将 MigratedToId 的值替换为与要迁移到的 Front Door 层匹配的 WAF 策略的资源 ID。 如果创建新的 WAF 策略副本,可以在资源 ID 中更改 WAF 策略的名称。
$wafMapping1 = New-AzFrontDoorCdnMigrationWebApplicationFirewallMappingObject -MigratedFromId /subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourcegroups/myAFDResourceGroup/providers/Microsoft.Network/frontdoorwebapplicationfirewallpolicies/myClassicFrontDoorWAF1 -MigratedToId /subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourcegroups/myAFDResourceGroup/providers/Microsoft.Network/frontdoorwebapplicationfirewallpolicies/myFrontDoorWAF1
$wafMapping2 = New-AzFrontDoorCdnMigrationWebApplicationFirewallMappingObject -MigratedFromId /subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourcegroups/myAFDResourceGroup/providers/Microsoft.Network/frontdoorwebapplicationfirewallpolicies/myClassicFrontDoorWAF2 -MigratedToId /subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourcegroups/myAFDResourceGroup/providers/Microsoft.Network/frontdoorwebapplicationfirewallpolicies/myFrontDoorWAF2
在变量中指定两种托管标识类型。
$identityType = "SystemAssigned, UserAssigned"
运行 Get-AzUserAssignedIdentity 命令获取用户分配标识的资源 ID。
$id1 = Get-AzUserAssignedIdentity -ResourceGroupName myResourceGroup -Name afduseridentity1
$id1.Id
$id2 = Get-AzUserAssignedIdentity -ResourceGroupName myResourceGroup -Name afduseridentity2
$id2.Id
输出与下面类似:
/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourcegroups/myAFDResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/afduseridentity1
/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourcegroups/myAFDResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/afduseridentity2
在变量中指定用户分配的标识资源 ID。
$userInfo = @{
"subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/afduseridentity1" = @{}}
"subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/afduseridentity2" = @{}}
}
运行 Start-AzFrontDoorCdnProfilePrepareMigration 命令以准备迁移。 将资源组名称、资源 ID 和配置文件名称的值替换为自己的值。 对于 SkuName,请使用 Standard_AzureFrontDoor 或 Premium_AzureFrontDoor。
SkuName 基于 Test-AzFrontDoorCdnProfileMigration 命令的输出。
MigrationWebApplicationFirewallMapping 参数接受一个包含 WAF 策略迁移对象的数组。
IdentityType 参数采用以逗号分隔的标识类型列表。
IdentityUserAssignedIdentity 参数采用用户分配的标识资源 ID 的哈希表。
替换命令中的以下值:
-
<subscriptionId>:订阅 ID。
-
<resourceGroupName>:Front Door(经典)的资源组名称。
-
<frontdoorClassicName>:Front Door(经典)配置文件的名称。
Start-AzFrontDoorCdnProfilePrepareMigration -ResourceGroupName <resourceGroupName> -ClassicResourceReferenceId /subscriptions/<subscriptionId>/resourcegroups/<resourceGroupName>/providers/Microsoft.Network/frontdoors/<frontdoorClassicName> -ProfileName myAzureFrontDoor -SkuName Premium_AzureFrontDoor -MigrationWebApplicationFirewallMapping @($wafMapping1, $wafMapping2) -IdentityType $identityType -IdentityUserAssignedIdentity $userInfo
输出与下面类似:
Starting the parameter validation process.
The parameters are successfully validated.
Your new Front Door profile is being created. Wait until the process finishes. This process might take several minutes.
Your new Front Door profile with the configuration is successfully created.
迁移
运行 Enable-AzFrontDoorCdnProfileMigration 命令以迁移你的 Front Door(经典版)。
Enable-AzFrontDoorCdnProfileMigration -ProfileName myAzureFrontDoor -ResourceGroupName myAFDResourceGroup
输出与下面类似:
Start to migrate.
This process disables your Front Door (classic) profile and moves all your traffic and configurations to the new Front Door profile.
Migrate succeeded.
运行 Stop-AzFrontDoorCdnProfileMigration 命令以中止迁移过程。
Stop-AzFrontDoorCdnProfileMigration -ProfileName myAzureFrontDoor -ResourceGroupName myAFDResourceGroup
输出与下面类似:
Start to abort the migration.
Your new Front Door profile is deleted and your existing profile remains active. WAF policies aren't deleted.
Wait until the process finishes. This process can take several minutes.
Abort succeeded.
迁移后端点切换
Azure Front Door(经典)使用与 Azure Front Door 标准版或高级版不同的完全限定域名 (FQDN)。 例如,经典版终结点可能是 contoso.azurefd.net,标准或高级版终结点可能是 contoso-mdjf2jfgjf82mnzx.z01.azurefd.net。 有关详细信息,请参阅 Azure Front Door 中的终结点。
尽管 Azure Front Door 会自动将流量从经典端点路由到你的新标准或高级配置文件,且不需更改配置,但根据你的情况,你必须完成以下迁移后操作:
两个端点在过渡期间都能正常工作,因此你可以在没有停机的情况下进行并验证这一更改。
Warning
请在2028年3月31日前完成向新 Azure Front Door 标准/高级端点的切换。 从2028年4月1日起,经典端点不再支持,可能会停止运行。 仍然依赖经典端点的自定义域名、应用程序或客户端可能会停止接收流量。
相关内容