升級 Azure 公用 Load BalancerUpgrade Azure Public Load Balancer

Azure Standard Load Balancer 透過區域冗余提供一組豐富的功能和高可用性。Azure Standard Load Balancer offers a rich set of functionality and high availability through zone redundancy. 若要深入瞭解 Load Balancer SKU,請參閱 比較表To learn more about Load Balancer SKU, see comparison table.

升級階段分為兩個階段:There are two stages in an upgrade:

  1. 將 IP 配置方法從動態變更為靜態。Change IP allocation method from Dynamic to Static.
  2. 執行 PowerShell 腳本,以完成升級和流量遷移。Run the PowerShell script to complete the upgrade and traffic migration.

升級概觀Upgrade overview

有 Azure PowerShell 腳本可用來執行下列動作:An Azure PowerShell script is available that does the following:

  • 使用您在基本 Standard Load Balancer 的相同資源群組中指定的位置,建立標準 SKU Load Balancer。Creates a Standard SKU Load Balancer with location you specify in the same resource group of the Basic Standard Load Balancer.
  • 就地將公用 IP 位址從基本 SKU 升級到標準 SKU。Upgrades Public IP address from Basic SKU to Standard SKU in-place.
  • 將基本 SKU Load Balancer 的設定順暢地複製到新建立的 Standard Load Balancer。Seamlessly copies the configurations of the Basic SKU Load Balancer to the newly create Standard Load Balancer.
  • 建立預設輸出規則,以啟用輸出連線能力。Creates a default outbound rule which enables outbound connectivity.

Caveats\LimitationsCaveats\Limitations

  • 腳本只支援公用 Load Balancer 升級。Script only supports Public Load Balancer upgrade. 如需瞭解內部基本 Load Balancer 升級,請參閱 此頁面 以取得相關指示。For Internal Basic Load Balancer upgrade, refer to this page for instructions.
  • 在執行腳本之前,必須將公用 IP 位址的配置方法變更為「靜態」。The allocation method of the Public IP Address has to be changed to "static" before running the script.
  • 如果您的 Load Balancer 沒有任何前端 IP 設定或後端集區,您可能會遇到執行腳本的錯誤。If your Load Balancer does not have any frontend IP configuration or backend pool, you are likely to hit an error running the script. 請確認它們不是空的。Please make sure they are not empty.

將公用 IP 位址的配置方法變更為靜態Change Allocation method of the Public IP Address to Static

  • * * 以下是我們的建議步驟:**Here are our recommended steps:

    1. 若要進行本快速入門中的工作,請登入 Azure 入口網站To do the tasks in this quickstart, sign in to the Azure portal.

    2. 選取左側功能表上的 [ 所有資源 ],然後從 [資源] 清單中選取 與基本 Load Balancer 相關聯的基本公用 IP 位址Select All resources on the left menu, and then select the Basic Public IP Address associated with Basic Load Balancer from the resource list.

    3. 在 [設定] 底下 ,選取 [****設定]。Under Settings, select Configurations.

    4. 在 [指派] 下方,選取 [靜態]。Under Assignment, select Static.

    5. 選取 [儲存]。Select Save.

    注意

    對於具有公用 Ip 的 Vm,您必須先建立標準 IP 位址,但不保證相同的 IP 位址。For VMs which have Public IPs, you will need to create Standard IP addresses first where same IP address is not guaranteed. 將 Vm 與基本 ip 解除關聯,並將其與新建立的標準 IP 位址建立關聯。Disassociate VMs from Basic IPs and associate them with the newly created Standard IP addresses. 然後,您將可以依照指示,將 Vm 新增至 Standard Load Balancer 的後端集區。Then, you will be able to follow instructions to add VMs into backend pool of Standard Load Balancer.

  • 建立新的 vm,以新增至新建立的標準公用 Load Balancer 的後端 集區。Creating new VMs to add to the backend pools of the newly created Standard Public Load Balancer.

    • 您可以在 這裡找到更多有關如何建立 VM 並將其與 Standard Load Balancer 建立關聯的指示。More instructions on how to create VM and associate it with Standard Load Balancer can be found here.

下載腳本Download the script

PowerShell 資源庫下載遷移腳本。Download the migration script from the PowerShell Gallery.

使用腳本Use the script

您可以根據本機 PowerShell 環境的設定和喜好設定,選擇兩個選項:There are two options for you depending on your local PowerShell environment setup and preferences:

  • 如果您未安裝 Azure Az 模組,或不想要卸載 Azure Az 模組,最佳選項是使用 Install-Script 選項來執行腳本。If you don’t have the Azure Az modules installed, or don’t mind uninstalling the Azure Az modules, the best option is to use the Install-Script option to run the script.
  • 如果您需要保留 Azure Az 模組,最好的做法是直接下載並執行腳本。If you need to keep the Azure Az modules, your best bet is to download the script and run it directly.

若要判斷您是否已安裝 Azure Az 模組,請執行 Get-InstalledModule -Name azTo determine if you have the Azure Az modules installed, run Get-InstalledModule -Name az. 如果您沒有看到任何已安裝的 Az 模組,則可以使用 Install-Script 方法。If you don't see any installed Az modules, then you can use the Install-Script method.

使用 Install-Script 方法安裝Install using the Install-Script method

若要使用此選項,您的電腦上不能安裝 Azure Az 模組。To use this option, you must not have the Azure Az modules installed on your computer. 如果已安裝,則下列命令會顯示錯誤。If they're installed, the following command displays an error. 您可以卸載 Azure Az 模組,或使用另一個選項來手動下載腳本並加以執行。You can either uninstall the Azure Az modules, or use the other option to download the script manually and run it.

使用下列命令來執行指令碼:Run the script with the following command:

Install-Script -Name AzurePublicLBUpgrade

此命令也會安裝必要的 Az 模組。This command also installs the required Az modules.

使用腳本直接安裝Install using the script directly

如果您已安裝一些 Azure Az 模組,但無法將它們卸載 (或不想將它們卸載) ,您可以使用腳本下載連結中的 [ 手動下載 ] 索引標籤,手動下載腳本。If you do have some Azure Az modules installed and can't uninstall them (or don't want to uninstall them), you can manually download the script using the Manual Download tab in the script download link. 腳本會以原始 nupkg 檔案的形式下載。The script is downloaded as a raw nupkg file. 若要從此 nupkg 檔安裝腳本,請參閱 手動下載套件To install the script from this nupkg file, see Manual Package Download.

執行指令碼:To run the script:

  1. 使用 Connect-AzAccount 連接至 Azure。Use Connect-AzAccount to connect to Azure.

  2. Import-Module Az 來匯入 Az 模組。Use Import-Module Az to import the Az modules.

  3. 檢查必要的參數:Examine the required parameters:

    • oldRgName: [字串]:必要 項–這是您現有基本 Load Balancer 您想要升級的資源群組。oldRgName: [String]: Required – This is the resource group for your existing Basic Load Balancer you want to upgrade. 若要尋找此字串值,請流覽至 [Azure 入口網站],選取您的基本 Load Balancer 來源,然後按一下負載平衡器的 總覽To find this string value, navigate to Azure portal, select your Basic Load Balancer source, and click the Overview for the load balancer. 資源群組位於該頁面上。The Resource Group is located on that page.
    • oldLBName: [字串]:必要 項–這是您想要升級的現有基本平衡器名稱。oldLBName: [String]: Required – This is the name of your existing Basic Balancer you want to upgrade.
    • newLBName: [字串]: Required –這是要建立之 Standard Load Balancer 的名稱。newLBName: [String]: Required – This is the name for the Standard Load Balancer to be created.
  4. 使用適當的參數執行腳本。Run the script using the appropriate parameters. 可能需要5到七分鐘才能完成。It may take five to seven minutes to finish.

    範例Example

    AzurePublicLBUpgrade.ps1 -oldRgName "test_publicUpgrade_rg" -oldLBName "LBForPublic" -newLbName "LBForUpgrade"
    

建立輸出連接的輸出規則Create an outbound rule for outbound connection

遵循 指示 來建立輸出規則,讓您可以Follow the instructions to create an outbound rule so you can

  • 從頭開始定義輸出 NAT。Define outbound NAT from scratch.
  • 調整和調整現有輸出 NAT 的行為。Scale and tune the behavior of existing outbound NAT.

常見問題Common questions

將設定從 v1 遷移至 v2 的 Azure PowerShell 腳本是否有任何限制?Are there any limitations with the Azure PowerShell script to migrate the configuration from v1 to v2?

是。Yes. 請參閱 警告/限制See Caveats/Limitations.

升級需要多久的時間?How long does the upgrade take?

腳本需要大約大約5-10 分鐘的時間才能完成,而且可能需要較長的時間,視 Load Balancer 設定的複雜度而定。It usually take about 5-10 minutes for the script to finish and it could take longer depending on the complexity of your Load Balancer configuration. 因此,請記住停機時間並規劃容錯移轉(如有必要)。Therefore, keep the downtime in mind and plan for failover if necessary.

Azure PowerShell 腳本是否也會將基本 Load Balancer 的流量切換至新建立的 Standard Load Balancer?Does the Azure PowerShell script also switch over the traffic from my Basic Load Balancer to the newly created Standard Load Balancer?

是。Yes. Azure PowerShell 腳本不只會升級公用 IP 位址、將設定從基本複製到 Standard Load Balancer,也會將 VM 遷移至新建立的標準公用 Load Balancer 後方。The Azure PowerShell script not only upgrades the Public IP address, copies the configuration from Basic to Standard Load Balancer, but also migrates VM to behind the newly created Standard Public Load Balancer as well.

下一步Next steps

瞭解 Standard Load BalancerLearn about Standard Load Balancer