適用於:✔️ 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 Standard 或 Premium 設定檔的原始群組設定中啟用。 在 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 指令來測試你的個人資料。 將資源群組名稱和資源識別碼的值取代為您自己的值。 使用 Get-AzFrontDoor 來取得 Front Door (傳統) 設定檔的資源識別碼。
取代命令中的下列值:
-
<subscriptionId>:訂用帳戶識別碼。
-
<resourceGroupName>:Front Door(classic)的資源群組名稱。
-
<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 Government Cloud 中不支援管理憑證。 您需要在 Azure Government Cloud 中為 Azure Front Door Standard 或 Premium 使用 BYOC,或等到此功能可用。
執行 Start-AzFrontDoorCdnProfilePrepareMigration 命令來準備移轉。 將資源群組名稱、資源 ID 和設定檔名稱的值替換成你自己的值。
SkuName 請使用 Standard_AzureFrontDoor 或 Premium_AzureFrontDoor。
SkuName 是以 Test-AzFrontDoorCdnProfileMigration 命令的輸出為基礎。
取代命令中的下列值:
-
<subscriptionId>:訂用帳戶識別碼。
-
<resourceGroupName>:Front Door(classic)的資源群組名稱。
-
<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 原則的資源識別碼。 將資源群組名稱和 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 識別碼。 若要使用現有的 WAF 原則,請將 MigratedToId 的值取代為符合您要移轉到其中的 Front Door 層的 WAF 原則的資源識別碼。 如果您要建立新的 WAF 原則複本,您可以在資源識別碼中變更 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 命令來準備移轉。 將資源群組名稱、資源識別碼、設定檔名稱的值取代為您自己的值。 針對 SkuName 使用 Standard_AzureFrontDoor 或 Premium_AzureFrontDoor。
SkuName 是以 Test-AzFrontDoorCdnProfileMigration 命令的輸出為基礎。
取代命令中的下列值:
-
<subscriptionId>:訂用帳戶識別碼。
-
<resourceGroupName>:Front Door(classic)的資源群組名稱。
-
<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 = Get-AzUserAssignedIdentity -ResourceGroupName myResourceGroup -Name afduseridentity
$id.Id
輸出大致如下:
/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourcegroups/myAFDResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/afduseridentity
針對 IdentityType,請使用 UserAssigned;而針對 IdentityUserAssignedIdentity,* 請使用上一個步驟中的資源識別碼。
取代命令中的下列值:
-
<subscriptionId>:訂用帳戶識別碼。
-
<resourceGroupName>:Front Door(classic)的資源群組名稱。
-
<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 原則的資源識別碼。 將資源群組名稱和 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 識別碼。 若要使用現有的 WAF 原則,請將 MigratedToId 的值取代為符合您要移轉到其中的 Front Door 層的 WAF 原則的資源識別碼。 如果您要建立新的 WAF 原則複本,您可以在資源識別碼中變更 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 命令,以取得使用者指派身分識別的資源識別符。
$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
在變數中指定使用者指派的身分識別資源標識碼。
$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 命令來準備移轉。 將資源群組名稱、資源識別碼、設定檔名稱的值取代為您自己的值。 針對 SkuName 使用 Standard_AzureFrontDoor 或 Premium_AzureFrontDoor。
SkuName 是以 Test-AzFrontDoorCdnProfileMigration 命令的輸出為基礎。
MigrationWebApplicationFirewallMapping 參數會採用 WAF 原則移轉物件陣列。
IdentityType 參數會採用以逗號分隔的身分識別類型清單。
IdentityUserAssignedIdentity 參數會採用使用者指派身分識別資源識別碼的雜湊表。
取代命令中的下列值:
-
<subscriptionId>:訂用帳戶識別碼。
-
<resourceGroupName>:Front Door(classic)的資源群組名稱。
-
<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 日起,經典端點將不再支援,可能會停止運作。 仍依賴傳統端點的自訂網域、應用程式或用戶端可能會停止接收流量。
相關內容