使用 Azure Vm 和 SQL Server Always On 可用性群組重新裝載內部部署應用程式Rehost an on-premises application with Azure VMs and SQL Server Always On availability groups

本文示範虛構公司 Contoso 如何如何在 VMware 虛擬機器上執行的兩層式 Windows .NET 應用程式, (Vm) 作為遷移至 Azure 的一部分。This article demonstrates how the fictional company Contoso rehosts a two-tier Windows .NET application running on VMware virtual machines (VMs) as part of a migration to Azure. Contoso 會將應用程式前端 VM 遷移至 Azure VM,並將應用程式資料庫移轉至另一部具有 sql Server 的 Azure VM,並在具有 SQL Server Always On 可用性群組的 Windows Server 容錯移轉叢集中執行。Contoso migrates the application front-end VM to an Azure VM, and the application database to another Azure VM with SQL Server, running in a Windows Server failover cluster with SQL Server Always On availability groups.

此範例中使用的 SmartHotel360 應用程式是以開放原始碼軟體的形式提供。The SmartHotel360 application used in this example is provided as open-source software. 如果您想要將它用於您自己的測試用途,請從 GitHub下載。If you want to use it for your own testing purposes, download it from GitHub.

商業動機Business drivers

IT 領導小組與商務合作夥伴密切合作,瞭解他們想要使用這種方式達成什麼目標。The IT leadership team has worked closely with business partners to understand what they want to achieve with this migration. 他們想要:They want to:

  • 解決業務成長。Address business growth. Contoso 正在成長,因此對內部部署系統和基礎結構造成了壓力。Contoso is growing, and as a result there's pressure on on-premises systems and infrastructure.
  • 提高效率。Increase efficiency. Contoso 必須移除不必要的程式,並簡化開發人員和使用者的流程。Contoso needs to remove unnecessary procedures and streamline processes for developers and users. 企業需要快速且不浪費時間或金錢,以更快的速度提供客戶的需求。The business needs IT to be fast and not waste time or money to deliver faster on customer requirements.
  • 增加靈活性。Increase agility. Contoso IT 必須能夠更快因應企業的需求。Contoso IT needs to be more responsive to the needs of the business. 它必須比 marketplace 中的變更更快,以實現全球經濟的成功。It must react faster than the changes in the marketplace to enable success in a global economy. 它不得取得或成為企業封鎖程式。IT mustn't get in the way or become a business blocker.
  • 規模。Scale. 隨著企業順利成長,Contoso IT 必須提供以相同步調成長的系統。As the business grows successfully, Contoso IT must provide systems that grow at the same pace.

移轉目標Migration goals

Contoso 雲端小組已針對此次移轉擬定好各項目標。The Contoso cloud team has pinned down goals for this migration. 這些目標用來判斷最合適的移轉方法:These goals were used to determine the best migration method:

  • 在遷移之後,Azure 中的應用程式應該具有與現今在 VMware 中相同的效能功能。After migration, the application in Azure should have the same performance capabilities as it does today in VMware. 應用程式在內部部署環境中將會保持在雲端中的重要性。The application will remain as critical in the cloud as it is on-premises.
  • Contoso 不想要投資此應用程式。Contoso doesn't want to invest in this application. 這對企業很重要,但以其目前的形式而言,Contoso 只想要將它安全地移至雲端。It's important to the business, but in its current form, Contoso simply wants to move it safely to the cloud.
  • 應用程式的內部部署資料庫發生可用性問題。The on-premises database for the application has had availability issues. Contoso 想要在 Azure 中將其部署為具有容錯移轉功能的高可用性叢集。Contoso want to deploy it in Azure as a high-availability cluster with failover capabilities.
  • Contoso 想要從目前的 SQL Server 2008 R2 平臺升級至 SQL Server 2017。Contoso wants to upgrade from its current SQL Server 2008 R2 platform to SQL Server 2017.
  • Contoso 不想對此應用程式使用 Azure SQL Database,且正在尋找替代方案。Contoso doesn't want to use Azure SQL Database for this application and is looking for alternatives.

解決方案設計Solution design

完成公司的目標和需求後,Contoso 會設計和審核部署解決方案,並識別遷移程式。After pinning down the company's goals and requirements, Contoso designs and reviews a deployment solution and identifies the migration process. 也會識別其將用於遷移的 Azure 服務。The Azure services that it will use for the migration also are identified.

目前架構Current architecture

  • 應用程式會分層至兩個 Vm (WEBVMSQLVM) 。The application is tiered across two VMs (WEBVM and SQLVM).
  • VM 位於 VMware ESXi 主機 contosohost1.contoso.com(6.5 版)。The VMs are located on VMware ESXi host contosohost1.contoso.com (version 6.5).
  • VMware 環境是由 vcenter.contoso.com VM 上執行的 VCenter Server 6.5 () 所管理。The VMware environment is managed by vCenter Server 6.5 (vcenter.contoso.com) that runs on a VM.
  • Contoso 有內部部署資料中心 () 搭配內部 contoso-datacenter 部署網域控制站 (contosodc1) 。Contoso has an on-premises datacenter (contoso-datacenter) with an on-premises domain controller (contosodc1).

建議的架構Proposed architecture

在此情節中:In this scenario:

  • Contoso 會將應用程式前端遷移 WEBVM 至 Azure 基礎結構即服務 (IaaS) VM。Contoso will migrate the application front end WEBVM to an Azure infrastructure as a service (IaaS) VM.

    • Azure 中的前端 VM 將部署在資源群組中, ContosoRG (用於生產資源) 。The front-end VM in Azure will be deployed in the ContosoRG resource group (used for production resources).
    • 它會位於主要區域中的 Azure 生產網路 (VNET-PROD-EUS2) (East US 2) 。It will be located in the Azure production network (VNET-PROD-EUS2) in the primary region (East US 2).
  • 應用程式資料庫將會遷移至執行 SQL Server 的 Azure VM。The application database will be migrated to an Azure VM running SQL Server.

    • 它會位於 Contoso 的 Azure 資料庫網路 (PROD-DB-EUS2) 在主要區域 (East US 2) 。It will be located in Contoso's Azure database network (PROD-DB-EUS2) in the primary region (East US 2).
    • 它會放在 Windows Server 容錯移轉叢集中,其中有兩個使用 SQL Server Always On 可用性群組的節點。It will be placed in a Windows Server failover cluster with two nodes that uses SQL Server Always On availability groups.
    • 在 Azure 中,叢集中的兩個 SQL Server VM 節點將會部署在 ContosoRG 資源群組中。In Azure, the two SQL Server VM nodes in the cluster will be deployed in the ContosoRG resource group.
    • VM 節點將位於主要區域中的 Azure 生產網路 (VNET-PROD-EUS2) (East US 2) 。The VM nodes will be located in the Azure production network (VNET-PROD-EUS2) in the primary region (East US 2).
    • Vm 將會執行具有 SQL Server 2017 Enterprise edition 的 Windows Server 2016。VMs will run Windows Server 2016 with SQL Server 2017 Enterprise edition. Contoso 沒有此作業系統的授權。Contoso doesn't have licenses for this operating system. 它會使用 Azure Marketplace 中的映射,以提供公司 Azure Enterprise 合約承諾用量的授權。It will use an image in Azure Marketplace that provides the license as a charge to the company's Azure Enterprise Agreement commitment.
    • 除了唯一名稱以外,這兩個 VM 所使用的設定皆相同。Apart from unique names, both VMs use the same settings.
  • Contoso 會部署內部負載平衡器,以接聽叢集中的流量,並將它導向至適當的叢集節點。Contoso will deploy an internal load balancer that listens for traffic on the cluster and directs it to the appropriate cluster node.

    • 內部負載平衡器會部署在 ContosoNetworkingRG 用於網路資源) 的 (中。The internal load balancer will be deployed in ContosoNetworkingRG (used for networking resources).
  • 移轉完成之後,將會解除委任 Contoso 資料中心的內部部署 VM。The on-premises VMs in the Contoso datacenter will be decommissioned after the migration is done.


資料庫考量Database considerations

在解決方案設計過程中,Contoso 會進行 Azure SQL Database 與 SQL Server 的功能比較。As part of the solution design process, Contoso did a feature comparison between Azure SQL Database and SQL Server. 下列考慮有助於公司決定要使用執行 SQL Server 的 Azure IaaS VM:The following considerations helped the company to decide to use an Azure IaaS VM running SQL Server:

  • 如果 Contoso 需要自訂作業系統或資料庫伺服器,或可能想要在相同的 VM 上共置和執行協力廠商應用程式,則使用執行 SQL Server 的 Azure VM 似乎是最佳解決方案。Using an Azure VM running SQL Server seems to be an optimal solution if Contoso needs to customize the operating system or the database server, or if it might want to colocate and run third-party applications on the same VM.

解決方案檢閱Solution review

Contoso 藉由結合一份優缺點來評估其提議的設計。Contoso evaluates its proposed design by putting together a list of pros and cons.

考量Consideration 詳細資料Details
優點Pros WEBVM 將會移至 Azure 而不需要變更,以簡化遷移工作。WEBVM will be moved to Azure without changes, which makes the migration simple.

SQL Server 層將會在 SQL Server 2017 和 Windows Server 2016 上執行,以淘汰目前的 Windows Server 2008 R2 作業系統。The SQL Server tier will run on SQL Server 2017 and Windows Server 2016, which retires the current Windows Server 2008 R2 operating system. 執行 SQL Server 2017 可支援 Contoso 的技術需求和目標。Running SQL Server 2017 supports Contoso's technical requirements and goals. 它提供了100% 的相容性,而不是從 SQL Server 2008 R2 移開。IT provides 100 percent compatibility while moving away from SQL Server 2008 R2.

Contoso 可以利用 Azure 混合式權益,充分利用其軟體保證的投資。Contoso can take advantage of its investment in Software Assurance by using the Azure Hybrid Benefit.

Azure 中的高可用性 SQL Server 部署提供容錯功能,因此應用程式資料層不再是單一容錯移轉點。A high-availability SQL Server deployment in Azure provides fault tolerance so that the application data tier is no longer a single point of failover.
缺點Cons WEBVM 正在執行 Windows Server 2008 R2。WEBVM is running Windows Server 2008 R2. Azure 對此作業系統的支援僅限於特定角色 (2018 年 7 月)。The operating system is supported by Azure for specific roles (July 2018). 若要深入瞭解,請參閱 Azure 虛擬機器的 Microsoft 伺服器軟體支援To learn more, see Microsoft server software support for Azure Virtual Machines.

應用程式的 web 層仍是單一容錯移轉點。The web tier of the application remains a single point of failover.

Contoso 必須繼續支援作為 Azure VM 的 web 層,而不是移至受控服務(例如 Azure App Service)。Contoso needs to continue supporting the web tier as an Azure VM rather than moving to a managed service such as Azure App Service.

使用選擇的解決方案,Contoso 必須繼續管理兩個 SQL Server Vm,而不是移至受控平臺,例如 Azure SQL 受控實例。With the chosen solution, Contoso will need to continue managing two SQL Server VMs rather than moving to a managed platform, such as Azure SQL Managed Instance. 此外,透過軟體保證,Contoso 可以在 Azure SQL 受控實例上交換其現有授權以取得折扣費率。In addition, with Software Assurance, Contoso could exchange its existing licenses for discounted rates on Azure SQL Managed Instance.

Azure 服務Azure services

服務Service 描述Description 成本Cost
Azure 資料庫移轉服務Azure Database Migration Service Azure 資料庫移轉服務可讓您從多個資料庫來源順暢地遷移到 Azure 資料平臺,並減少停機時間。Azure Database Migration Service enables seamless migration from multiple database sources to Azure data platforms with minimal downtime. 深入瞭解 支援的區域Azure 資料庫移轉服務定價Learn about supported regions and Azure Database Migration Service pricing.
Azure MigrateAzure Migrate Contoso 會使用 Azure 遷移來評定其 VMware Vm。Contoso uses Azure Migrate to assess its VMware VMs. Azure Migrate 會評定機器是否適合移轉。Azure Migrate assesses the migration suitability of the machines. 它會提供在 Azure 中執行的大小調整建議和成本估計。It provides sizing and cost estimates for running in Azure. 不須額外費用即可使用 Azure Migrate。Azure Migrate is available at no additional charge. 它們可能會產生費用,視 (第一方或獨立軟體廠商的工具而定,) 他們決定用來進行評量和遷移。They might incur charges depending on the tools (first-party or independent software vendor) they decide to use for assessment and migration. 深入瞭解 Azure 遷移定價Learn more about Azure Migrate pricing.

移轉程序Migration process

Contoso 管理員會將應用程式 Vm 遷移至 Azure。The Contoso admins will migrate the application VMs to Azure.

  • 他們會使用 Azure 遷移將前端 VM 遷移至 Azure VM:They'll migrate the front-end VM to Azure VM by using Azure Migrate:

    • 在第一個步驟中,他們會準備及設定 Azure 元件,並準備內部部署 VMware 基礎結構。As a first step, they'll prepare and set up Azure components and prepare the on-premises VMware infrastructure.
    • 一切就緒後,他們就可以開始複寫 VM。With everything prepared, they can start replicating the VM.
    • 啟用複寫並正常運作之後,他們會使用 Azure 遷移來遷移 VM。After replication is enabled and working, they migrate the VM by using Azure Migrate.
  • 在驗證資料庫之後,他們會使用 Azure 資料庫移轉服務,將資料庫移轉至 Azure 中的 SQL Server 叢集。After they've verified the database, they'll migrate the database to a SQL Server cluster in Azure by using Azure Database Migration Service.

    • 在第一個步驟中,他們必須在 Azure 中布建 SQL Server Vm、設定叢集和內部負載平衡器,並設定 Always On 可用性群組。As a first step, they'll need to provision SQL Server VMs in Azure, set up the cluster and an internal load balancer, and configure Always On availability groups.
    • 有了這項功能,他們就可以遷移資料庫。With this in place, they can migrate the database.
  • 在遷移之後,他們會為資料庫啟用 Always On 可用性群組。After the migration, they'll enable Always On availability groups for the database.



以下是 Contoso 在此案例中應該準備好的事項。Here's what Contoso needs to do for this scenario.

需求Requirements 詳細資料Details
Azure 訂用帳戶Azure subscription Contoso 已在本系列稍早的文章中建立訂用帳戶。Contoso already created a subscription in an earlier article in this series. 如果您沒有 Azure 訂用帳戶,請建立免費帳戶If you don't have an Azure subscription, create a free account.

如果您建立免費帳戶,您就是訂用帳戶的管理員,並可執行所有動作。If you create a free account, you're the administrator of your subscription and can perform all actions.

如果您使用現有的訂用帳戶,而且您不是系統管理員,請與系統管理員合作,指派擁有者或參與者許可權給您。If you use an existing subscription and you're not the administrator, work with the admin to assign you Owner or Contributor permissions.

Azure 基礎結構Azure infrastructure Contoso 會如適用於移轉的 Azure 基礎結構中所述,設定 Azure 基礎結構。Contoso set up the Azure infrastructure as described in Azure infrastructure for migration.

深入瞭解 Azure 遷移的特定 必要條件 需求:伺服器遷移。Learn more about specific prerequisites requirements for Azure Migrate: Server Migration.
內部部署伺服器On-premises servers 內部部署 vCenter 伺服器應執行5.5、6.0、6.5 或6.7 版。The on-premises vCenter Server should be running version 5.5, 6.0, 6.5, or 6.7.

執行5.5、6.0、6.5 或6.7 版本的 ESXi 主機。An ESXi host running version 5.5, 6.0, 6.5, or 6.7.

一或多部在 ESXi 主機上執行的 VMware VM。One or more VMware VMs running on the ESXi host.
內部部署 VMOn-premises VMs 檢閱已背書在 Azure 上執行的 Linux 機器Review Linux machines that are endorsed to run on Azure.

案例步驟Scenario steps

以下是 Contoso 執行移轉的方式:Here's how Contoso will run the migration:

  • 步驟1:準備 SQL Server Always On 可用性群組叢集。Step 1: Prepare a SQL Server Always On availability group cluster. 建立叢集,以在 Azure 中部署兩個 SQL Server VM 節點。Create a cluster for deploying two SQL Server VM nodes in Azure.
  • 步驟2:部署並設定叢集。Step 2: Deploy and set up the cluster. 準備 Azure 中的 SQL Server 叢集。Prepare a SQL Server cluster in Azure. 資料庫會移轉至這個現有的叢集中。Databases are migrated into this existing cluster.
  • 步驟3:部署 Azure 負載平衡器。Step 3: Deploy Azure Load Balancer. 部署負載平衡器,以平衡傳輸至 SQL Server 節點的流量。Deploy a load balancer to balance traffic to the SQL Server nodes.
  • 步驟4:準備 azure 以進行 Azure 遷移。Step 4: Prepare Azure for Azure Migrate. 建立 Azure 儲存體帳戶來保存複寫的資料。Create an Azure Storage account to hold replicated data.
  • 步驟5:準備內部部署 VMware 以進行 Azure 遷移。Step 5: Prepare on-premises VMware for Azure Migrate. 為帳戶進行 VM 探索和代理程式安裝的準備工作。Prepare accounts for VM discovery and agent installation. 準備內部部署 VM,讓使用者在移轉之後可連線至 Azure VM。Prepare on-premises VMs so that users can connect to Azure VMs after migration.
  • 步驟6:將內部部署 Vm 複寫至 Azure。Step 6: Replicate the on-premises VMs to Azure. 啟用對 Azure 複寫 VM 的功能。Enable VM replication to Azure.
  • 步驟7:透過 Azure 資料庫移轉服務遷移資料庫。Step 7: Migrate the database via Azure Database Migration Service. 使用 Azure 資料庫移轉服務,將資料庫移轉至 Azure。Migrate the database to Azure by using Azure Database Migration Service.
  • 步驟8:使用 SQL Server Always On 保護資料庫。Step 8: Protect the database with SQL Server Always On. 為叢集建立 Always On 可用性群組。Create an Always On availability group for the cluster.
  • 步驟9:使用 Azure 遷移來遷移 VM。Step 9: Migrate the VM with Azure Migrate. 執行測試移轉,確定一切都沒問題。Run a test migration to make sure everything's working as expected. 然後執行遷移至 Azure。Then run a migration to Azure.

步驟1:準備 SQL Server Always On 可用性群組叢集Step 1: Prepare a SQL Server Always On availability group cluster

若要設定叢集,Contoso 管理員:To set up the cluster, the Contoso admins:

  1. 在 Azure Marketplace 中選取 [SQL Server 2017 Enterprise Windows Server 2016] 映射,以建立兩個 SQL Server Vm。Create two SQL Server VMs by selecting SQL Server 2017 Enterprise Windows Server 2016 image in the Azure Marketplace.

    顯示 SQL VM SKU 的螢幕擷取畫面。

  2. 建立虛擬機器嚮導 的 > 基本概念 中,他們會設定:In Create Virtual Machine Wizard > Basics, they configure:

    • Vm 的名稱: SQLAOG1SQLAOG2Names for the VMs: SQLAOG1 and SQLAOG2.
    • 因為機器是業務關鍵性的,所以請為 VM 磁片類型啟用 SSD。Because machines are business-critical, enable SSD for the VM disk type.
    • 指定電腦認證。Specify machine credentials.
    • 他們會將 Vm 部署在主要區域中, (East US 2) 在 ContosoRG 資源群組中。They deploy the VMs in the primary region (East US 2) in the ContosoRG resource group.
  3. 大小 而言,它們是從 D2S v3 兩個 vm 的實例開始。In Size, they start with D2S v3 instances for both VMs. 稍後會視需要進行調整。They'll scale later as needed.

  4. 在 [ 設定] 中,他們會執行下列動作:In Settings, they do the following actions:

    • 因為這些 Vm 是應用程式的重要資料庫,所以會使用受控磁片。Because these VMs are critical databases for the application, they use managed disks.

    • 它們會將電腦放在資料庫子網中, (PROD-DB-EUS2 主要區域中的生產網路) (VNET-PROD-EUS2) (East US 2) 。They place the machines in the database subnet (PROD-DB-EUS2) of the production network (VNET-PROD-EUS2) in the primary region (East US 2).

    • 他們會建立新的可用性設定組 (SQLAOGAVSET) 包含兩個容錯網域和五個更新網域。They create a new availability set (SQLAOGAVSET) with two fault domains and five update domains.


  5. [Sql Server 設定] 中,它們會將虛擬網路的 SQL 連線能力限制在預設通訊埠1433上 (私用) 。In SQL Server settings, they limit SQL connectivity to the virtual network (private) on default port 1433. 針對驗證,他們使用的認證與在網站上使用的 (contosoadmin) 相同。For authentication, they use the same credentials as used on-site (contosoadmin).

    顯示 SQL Server 設定的螢幕擷取畫面。

需要其他協助?Need more help?

步驟 2︰部署並設定叢集Step 2: Deploy and set up the cluster

若要設定叢集,Contoso 管理員:To set up the cluster, the Contoso admins:

  1. 設定 Azure 儲存體帳戶以作為雲端見證。Set up an Azure Storage account to act as the cloud witness.
  2. 將 SQL Server Vm 新增至 Contoso 內部部署資料中心內的 Active Directory 網域。Add the SQL Server VMs to the Active Directory domain in the Contoso on-premises datacenter.
  3. 在 Azure 中建立叢集。Create the cluster in Azure.
  4. 設定雲端見證。Configure the cloud witness.
  5. 啟用 SQL Always On 可用性群組。Enable SQL Always On availability groups.

將儲存體帳戶設定為雲端見證Set up a storage account as a cloud witness

為了設定雲端見證,Contoso 必須要有 Azure 儲存體帳戶,用來保存用於叢集仲裁的 Blob 檔案。To set up a cloud witness, Contoso needs an Azure Storage account that will hold the blob file used for cluster arbitration. 相同的儲存體帳戶也可用來設定多個叢集的雲端見證。The same storage account can be used to set up cloud witness for multiple clusters.

若要建立儲存體帳戶,Contoso 管理員:To create a storage account, the Contoso admins:

  1. 請為帳戶 () 指定可辨識的名稱 contosocloudwitnessSpecify a recognizable name for the account (contosocloudwitness).

  2. 使用 LRS 部署一般的全用途帳戶。Deploy a general all-purpose account, with LRS.

  3. 將帳戶放在第三個區域中 (South Central US) 。Place the account in a third region (South Central US). 他們將它放在主要和次要區域外部,使其在區域失敗時仍可供使用。They place it outside the primary and secondary region so that it remains available during regional failure.

  4. 將它放在保存基礎結構資源的資源群組中 ContosoInfraRGPlace it in the resource group that holds infrastructure resources, ContosoInfraRG.


  5. 當他們建立儲存體帳戶時,系統會產生該帳戶的主要和次要存取金鑰。When they create the storage account, primary and secondary access keys are generated for it. 他們必須要有主要存取金鑰才能建立雲端見證。They need the primary access key to create the cloud witness. 金鑰會出現在儲存體帳戶名稱下 > 存取金鑰The key appears under the storage account name > Access keys.


將 SQL Server VM 新增至 Contoso 網域Add SQL Server VMs to Contoso domain

  1. Contoso 會將 SQLAOG1 和新增 SQLAOG2contoso.com 網域。Contoso adds SQLAOG1 and SQLAOG2 to the contoso.com domain.
  2. 在每部 VM 上,系統管理員會安裝 Windows 容錯移轉叢集功能和工具。On each VM, the admins install the Windows Failover Cluster feature and tools.

設定叢集Set up the cluster

在 Contoso 管理員設定叢集之前,他們會在每部機器上建立 OS 磁片的快照集。Before the Contoso admins set up the cluster, they take a snapshot of the OS disk on each machine.

顯示 [建立快照集] 窗格的螢幕擷取畫面。

  1. 他們會執行腳本來建立 Windows 容錯移轉叢集。They run a script to create the Windows failover cluster.

    顯示建立 Windows 容錯移轉叢集之腳本的螢幕擷取畫面。

  2. 建立叢集之後,他們會確認 Vm 顯示為叢集節點。After the cluster is created, they verify that the VMs appear as cluster nodes.


設定雲端見證Configure the cloud witness

  1. Contoso 管理員會使用 [容錯移轉叢集管理員] 中的 [ 仲裁設定] 來設定雲端見證。The Contoso admins configure the cloud witness by using the Quorum Configuration Wizard in Failover Cluster Manager.

  2. 在嚮導中,他們選擇使用儲存體帳戶建立雲端見證。In the wizard, they select to create a cloud witness with the storage account.

  3. 雲端見證設定完成後,它會出現在 [容錯移轉叢集管理員] 嵌入式管理單元中。After the cloud witness is configured, it appears in the Failover Cluster Manager snap-in.


啟用 SQL Server Always On 可用性群組Enable SQL Server Always On availability groups

Contoso 管理員現在可以啟用 Always On 可用性群組:The Contoso admins can now enable Always On availability groups:

  1. 在 SQL Server 組態管理員中,他們為 SQL Server (MSSQLSERVER) 服務啟用 Always On 可用性群組In SQL Server Configuration Manager, they enable Always On availability groups for the SQL Server (MSSQLSERVER) service.

    顯示 [啟用 Alwayson 可用性群組] 核取方塊的螢幕擷取畫面。

  2. 他們重新啟動服務讓變更生效。They restart the service for changes to take effect.

啟用 Always On 可用性群組之後,Contoso 可以設定將會保護 SmartHotel360 資料庫的 Always On 可用性群組。With Always On availability groups enabled, Contoso can set up the Always On availability group that will protect the SmartHotel360 database.

需要其他協助?Need more help?

步驟3:部署 Azure 負載平衡器Step 3: Deploy Azure Load Balancer

Contoso 管理員現在想要部署位於叢集節點前面的內部負載平衡器。The Contoso admins now want to deploy an internal load balancer that sits in front of the cluster nodes. 負載平衡器會接聽流量,並將其導向至適當的節點。The load balancer listens for traffic and directs it to the appropriate node.


若要建立負載平衡器,Contoso 管理員:To create the load balancer, the Contoso admins:

  1. 在 Azure 入口網站中,移至 [網路 > 負載平衡器],然後設定新的內部負載平衡器: ILB-PROD-DB-EUS2-SQLAOGIn the Azure portal, go to Networking > Load balancer, and set up a new internal load balancer: ILB-PROD-DB-EUS2-SQLAOG.

  2. 將負載平衡器放在 (PROD-DB-EUS2 生產網路) () 的資料庫子網中 VNET-PROD-EUS2Place the load balancer in the database subnet (PROD-DB-EUS2) of the production network (VNET-PROD-EUS2).

  3. () 將靜態 IP 位址指派給它 it a static IP address (

  4. 以網路功能元素的方式,在網路資源群組中部署負載平衡器 ContosoNetworkingRGAs a networking element, deploy the load balancer in the networking resource group ContosoNetworkingRG.

    顯示 [建立負載平衡器] 窗格的螢幕擷取畫面。

部署內部負載平衡器之後,Contoso 管理員必須設定它。After the internal load balancer is deployed, the Contoso admins need to set it up. 他們建立後端位址集區、設定健康情況探查,以及設定負載平衡規則。They create a back-end address pool, set up a health probe, and configure a load-balancing rule.

新增後端集區Add a back-end pool

為了將流量分散至叢集中的 Vm,Contoso 管理員設定了後端位址集區,其中包含將會從負載平衡器接收網路流量之 Vm 的 Nic IP 位址。To distribute traffic to the VMs in the cluster, the Contoso admins set up a back-end address pool that contains the IP addresses of the NICs for VMs that will receive network traffic from the load balancer.

  1. 在入口網站的負載平衡器設定中,Contoso 會新增後端集區: ILB-PROD-DB-EUS-SQLAOG-BEPOOLIn the load balancer settings in the portal, Contoso adds a back-end pool: ILB-PROD-DB-EUS-SQLAOG-BEPOOL.

  2. 系統管理員會將集區與可用性設定組產生關聯 SQLAOGAVSETThe admins associate the pool with availability set SQLAOGAVSET. 集合中的 Vm (SQLAOG1SQLAOG2) 都會新增至集區。The VMs in the set (SQLAOG1 and SQLAOG2) are added to the pool.

    顯示 [新增後端集區] 畫面的螢幕擷取畫面。

建立健康狀態探查Create a health probe

Contoso 管理員會建立健康情況探查,讓負載平衡器能夠監視應用程式健全狀況。The Contoso admins create a health probe so that the load balancer can monitor the application health. 探查會根據虛擬機器對健康狀態檢查的回應,以動態方式從負載平衡器輪替中新增或移除 Vm。The probe dynamically adds or removes VMs from the load balancer rotation based on how they respond to health checks.

若要建立探查,Contoso 管理員:To create the probe, the Contoso admins:

  1. 在入口網站的負載平衡器設定中,建立健康情況探查: >sqlalwaysonendpointprobeIn the load balancer settings in the portal, create a health probe: SQLAlwaysOnEndPointProbe.

  2. 設定探查以監視 TCP 埠59999上的 Vm。Set the probe to monitor VMs on TCP port 59999.

  3. 將探查之間的間隔設定為5秒,而臨界值為2。Set an interval of 5 seconds between probes and a threshold of 2. 如果有兩個探查失敗,VM 即會被視為狀況不良。If two probes fail, the VM will be considered unhealthy.

    顯示 [新增健康情況探查] 畫面的螢幕擷取畫面。

設定要接收流量的負載平衡器Configure the load balancer to receive traffic

現在,Contoso 管理員會設定負載平衡器規則,以定義如何將流量分散至 Vm。Now, the Contoso admins set up a load balancer rule to define how traffic is distributed to the VMs.

  • 前端 IP 位址會處理傳入流量。The front-end IP address handles incoming traffic.
  • 後端 IP 集區會接收流量。The back-end IP pool receives the traffic.

若要建立規則,Contoso 管理員:To create the rule, the Contoso admins:

  1. 在入口網站的負載平衡器設定中,新增規則: SQLAlwaysOnEndPointListenerIn the load balancer settings in the portal, add a new rule: SQLAlwaysOnEndPointListener.

  2. 設定前端接聽程式,以接收 TCP 埠1433上的連入 SQL 用戶端流量。Set a front-end listener to receive incoming SQL client traffic on TCP port 1433.

  3. 指定要將流量路由傳送到其中的後端集區,以及 Vm 用來接聽流量的埠。Specify the back-end pool to which traffic will be routed and the port on which VMs listen for traffic.

  4. 啟用浮動 IP (直接伺服器傳回) ,SQL Server Always On 一律需要這項功能。Enable floating IP (direct server return), which is always required for SQL Server Always On.


需要其他協助?Need more help?

步驟4:準備 Azure 以進行 Azure 遷移Step 4: Prepare Azure for Azure Migrate

以下是 Contoso 部署 Azure 遷移所需的 Azure 元件:Here are the Azure components Contoso needs to deploy Azure Migrate:

  • 在遷移 Vm 時,將在其中尋找 Vm 的虛擬網路。A virtual network in which VMs will be located when they're migrated.
  • 用來保存複寫資料的 Azure 儲存體帳戶。An Azure Storage account to hold replicated data.

Contoso 管理員會設定這些元件:The Contoso admins set up these components:

  1. Contoso 已建立可在 部署 azure 基礎結構時用於 Azure 遷移的網路/子網。Contoso already created a network/subnet it can use for Azure Migrate when it deployed the Azure infrastructure.

    • SmartHotel360 應用程式是生產應用程式, WEBVM 將會遷移到主要區域中的 Azure 生產網路 (VNET-PROD-EUS2) (East US 2) 。The SmartHotel360 application is a production application, and WEBVM will be migrated to the Azure production network (VNET-PROD-EUS2) in the primary region (East US 2).
    • WEBVM 將放在 ContosoRG 用於生產資源的資源群組中,而在生產子網中, (PROD-FE-EUS2) 。WEBVM will be placed in the ContosoRG resource group, which is used for production resources, and in the production subnet (PROD-FE-EUS2).
  2. Contoso 管理員會在主要區域中建立 Azure 儲存體帳戶 (contosovmsacc20180528) 。The Contoso admins create an Azure Storage account (contosovmsacc20180528) in the primary region.

    • 使用一般用途的帳戶搭配標準儲存體和 LRS 複寫。Use a general-purpose account with standard storage and LRS replication.

步驟5:準備內部部署 VMware 以進行 Azure 遷移Step 5: Prepare on-premises VMware for Azure Migrate

以下是 Contoso 管理員在內部部署環境中的準備工作:Here's what the Contoso admins prepare on-premises:

  • VCenter Server 或 vSphere ESXi 主機上的帳戶,可將 VM 探索自動化。An account on the vCenter Server or vSphere ESXi host to automate VM discovery.
  • 內部部署 VM 設定,讓 Contoso 在遷移後可以連線到複寫的 Azure VM。On-premises VM settings so that Contoso can connect to the replicated Azure VM after migration.

準備帳戶以進行自動探索Prepare an account for automatic discovery

Azure 遷移需要存取 VMware 伺服器,才能:Azure Migrate needs access to VMware servers to:

  • 自動探索 VM。Automatically discover VMs.
  • 協調複寫和遷移。Orchestrate replication and migration.
  • 需要至少一個唯讀帳戶。At least a read-only account is required. 他們需要可執行諸如建立和移除磁片以及開啟 Vm 等作業的帳戶。They need an account that can run operations such as creating and removing disks and turning on VMs.

若要設定帳戶,Contoso 管理員:To set up the account, the Contoso admins:

  1. 在 vCenter 層級建立一個角色。Create a role at the vCenter level.
  2. 將必要的許可權指派給該角色。Assign that role the required permissions.

準備在遷移後連接至 Azure VmPrepare to connect to Azure VMs after migration

在遷移之後,Contoso 想要連線至 Azure Vm,並允許 Azure 管理 Vm。After migration, Contoso wants to connect to the Azure VMs and allow Azure to manage the VMs. 若要這樣做,Contoso 管理員會在遷移之前執行下列工作:To do this, the Contoso admins do the following tasks before migration:

  1. 為了透過網際網路存取,他們會:For access over the internet, they:

    • 在遷移之前,先在內部部署 VM 上啟用 RDP 或 SSH。Enable RDP or SSH on the on-premises VM before migration.
    • 確定已為 公用 設定檔新增 TCP 和 UDP 規則。Ensure that TCP and UDP rules are added for the Public profile.
    • 檢查作業系統防火牆中是否允許 RDP 或 SSH。Check that RDP or SSH is allowed in the operating system firewall.
  2. 若要透過站對站 VPN 存取,他們:For access over Site-to-Site VPN, they:

    • 在遷移之前,先在內部部署 VM 上啟用 RDP 或 SSH。Enable RDP or SSH on the on-premises VM before migration.
    • 檢查作業系統防火牆中是否允許 RDP 或 SSH。Check that RDP or SSH is allowed in the operating system firewall.
    • 若為 Windows,請將內部部署 VM 上的作業系統 SAN 原則設定為 OnlineAllFor Windows, set the operating system's SAN policy on the on-premises VM to OnlineAll.
  3. 安裝 Azure 代理程式:Install the Azure agent:

  4. 其他Miscellaneous

    • 若是 Windows,在觸發遷移時,VM 上不應該有暫止的 Windows 更新。For Windows, there should be no Windows updates pending on the VM when triggering a migration. 如果有,Contoso 管理員將無法登入 VM,直到更新完成為止。If there are, the Contoso admins won't be able to sign in to the VM until the update completes.
    • 遷移後,他們可以檢查 開機診斷 以查看 VM 的螢幕擷取畫面。After migration, they can check Boot diagnostics to view a screenshot of the VM. 如果沒有作用,則應確認 VM 是否正在執行,並檢查這些 疑難排解秘訣If it doesn't work, they should verify that the VM is running and review these troubleshooting tips.

需要其他協助?Need more help?

瞭解如何 準備 vm 以進行遷移Learn about how to prepare VMs for migration.

步驟6:將內部部署 Vm 複寫至 AzureStep 6: Replicate the on-premises VMs to Azure

在 Contoso 管理員可以執行遷移至 Azure 之前,他們必須先設定並啟用複寫。Before the Contoso admins can run a migration to Azure, they need to set up and enable replication.

完成探索之後,他們就可以開始將 VMware Vm 複寫至 Azure。With discovery finished, they can begin replication of VMware VMs to Azure.

  1. 在 azure 遷移專案中,他們會移至 azure 遷移的 伺服器 > :伺服器遷移, 然後選取 [複寫]。In the Azure Migrate project, they go to Servers > Azure Migrate: Server Migration, and select Replicate.

    顯示 [複寫] 選項的螢幕擷取畫面。

  2. [ 複寫 > 來源設定] 中,您的 > 電腦虛擬化了嗎? 他們會選取 [是,使用 VMware vSphere]In Replicate > Source settings > Are your machines virtualized?, they select Yes, with VMware vSphere.

  3. 內部部署設備 中,他們會選取已設定的 Azure 遷移設備名稱,然後選取 [確定]In On-premises appliance, they select the name of the Azure Migrate appliance that was set up, and then select OK.

    顯示 [來源設定] 索引標籤的螢幕擷取畫面。

  4. 虛擬機器 中,他們會選取要複寫的機器。In Virtual machines, they select the machines to replicate.

    • 如果 Contoso 系統管理員已執行 Vm 的評量,則可以將 VM 大小調整和磁片類型套用至評定結果 (premium/standard) 建議。If the Contoso admins have run an assessment for the VMs, they can apply VM sizing and disk type (premium/standard) recommendations from the assessment results. 在 [ 從 Azure 遷移評估匯入遷移設定?] 中,他們會選取 [ 是] 選項。In Import migration settings from an Azure Migrate assessment?, they select the Yes option.
    • 如果他們未執行評量,或不想使用評量設定,則會選取 [ ] 選項。If they didn't run an assessment or don't want to use the assessment settings, they select the No option.
    • 如果他們選擇使用評量,他們會選取 VM 群組和評量名稱。If they selected to use the assessment, they select the VM group and assessment name.


  5. 虛擬機器 中,他們會視需要搜尋 vm,並檢查每個 vm 以進行遷移。In Virtual machines, they search for VMs as needed and check each VM to migrate. 然後選取 [下一步:目標設定]Then they select Next: Target settings.

  6. 在 [ 目標設定] 中,他們會選取要遷移的訂用帳戶和目的地區域,並指定 Azure vm 在遷移後將位於其中的資源群組。In Target settings, they select the subscription, and target region to which they'll migrate, and specify the resource group in which the Azure VMs will reside after migration. 虛擬網路 中,他們會選取 azure vm 在遷移後將加入的 azure 虛擬網路/子網。In Virtual Network, they select the Azure virtual network/subnet to which the Azure VMs will be joined after migration.

  7. Azure 混合式權益 中,Contoso 管理員:In Azure Hybrid Benefit, the Contoso admins:

    • 如果他們不想要套用 Azure 混合式權益,請選取 [ ]。Select No if they don't want to apply Azure Hybrid Benefit. 然後選取 [下一步]Then they select Next.
    • 如果他們的 Windows Server 電腦是使用中的軟體保證或 Windows Server 訂用帳戶,而且想要將權益套用至它們所要遷移的機器,請選取 [是]Select Yes if they have Windows Server machines that are covered with active Software Assurance or Windows Server subscriptions, and they want to apply the benefit to the machines they're migrating. 然後選取 [下一步]Then they select Next.
  8. 計算 中,他們會檢查 VM 名稱、大小、OS 磁片類型和可用性設定組。In Compute, they review the VM name, size, OS disk type, and availability set. VM 必須符合 Azure 需求VMs must conform with Azure requirements.

    • VM 大小: 如果他們使用評量建議,則 [VM 大小] 下拉式清單會包含建議的大小。VM size: If they're using assessment recommendations, the VM size drop-down list contains the recommended size. 否則,Azure 遷移會根據 Azure 訂用帳戶中最接近的相符項來挑選大小。Otherwise, Azure Migrate picks a size based on the closest match in the Azure subscription. 或者,他們可以選擇 AZURE VM 大小 的手動大小。Alternatively, they can pick a manual size in Azure VM size.
    • 作業系統磁片: 他們會為 VM 指定作業系統 (開機) 磁片。OS disk: They specify the OS (boot) disk for the VM. OS 磁碟是具有作業系統開機載入器和安裝程式的磁碟。The OS disk is the disk that has the operating system bootloader and installer.
    • 可用性設定組: 如果 VM 在遷移後應位於 Azure 可用性設定組中,則會指定該集合。Availability set: If the VM should be in an Azure availability set after migration, they specify the set. 此集合必須在為遷移所指定的目標資源群組中。The set must be in the target resource group specified for the migration.
  9. 磁片 中,它們會指定是否應將 VM 磁片複寫至 Azure。In Disks, they specify whether the VM disks should be replicated to Azure. 然後,他們會在 Azure 中選取 (標準 SSD/HDD 或 premium 受控磁片) 的磁片類型,然後選取 [下一步]Then they select the disk type (standard SSD/HDD or premium managed disks) in Azure and select Next.

    • 它們可以將磁片從複寫中排除。They can exclude disks from replication.
    • 如果將磁片排除,則在遷移後將不會出現在 Azure VM 上。If disks are excluded, they won't be present on the Azure VM after migration.
  10. 在 [ 檢查 + 開始 複寫] 中,他們會檢查設定。In Review + Start replication, they review the settings. 然後 ,他們會選取 [ 複寫] 以啟動伺服器的初始複寫。Then they select Replicate to start the initial replication for the servers.


複寫設定可以在複寫開始之前的任何時間更新,以 管理 複寫 > 機器Replication settings can be updated any time before replication starts in Manage > Replicating machines. 在複寫啟動後,就無法變更設定。Settings can't be changed after replication starts.

步驟7:透過 Azure 資料庫移轉服務遷移資料庫Step 7: Migrate the database via Azure Database Migration Service

Contoso 管理員會依照 逐步進行遷移教學課程,透過 Azure 資料庫移轉服務來遷移資料庫。The Contoso admins migrate the database via Azure Database Migration Service by following the step-by-step migration tutorial. 他們可以執行線上、離線和混合式 (預覽版) 的遷移。They can perform online, offline, and hybrid (preview) migrations.

總而言之,他們必須執行下列工作:As a summary, they must perform the following tasks:

  • 使用 Premium 定價層來建立連接到虛擬網路的 Azure 資料庫移轉服務實例。Use the Premium pricing tier to create an Azure Database Migration Service instance that connects to the virtual network.
  • 確定實例可以透過虛擬網路存取遠端 SQL Server。Ensure that the instance can access the remote SQL Server via the virtual network. 確定已在虛擬網路層級、網路 VPN 和裝載 SQL Server 的電腦上,允許所有連入埠從 Azure 到 SQL Server。Ensure that all incoming ports are allowed from Azure to SQL Server at the virtual network level, the network VPN, and the machine that hosts SQL Server.
  • 設定實例:Configure the instance:
    • 建立移轉專案。Create a migration project.
    • 將來源 (內部部署資料庫) 。Add a source (on-premises database).
    • 選取目標。Select a target.
    • 選取要遷移的資料庫。Select the databases to migrate.
    • 設定 [advanced settings]。Configure advanced settings.
    • 開始複寫。Start the replication.
    • 解決任何錯誤。Resolve any errors.
    • 執行最後的轉換。Perform the final cutover.

步驟8:使用 SQL Server Always On 保護資料庫Step 8: Protect the database with SQL Server Always On

在上執行的應用程式資料庫 SQLAOG1 中,Contoso 管理員現在可以使用 Always on 可用性群組來保護它。With the application database running on SQLAOG1, the Contoso admins can now protect it by using Always On availability groups. 他們使用 SQL Server Management Studio 設定 SQL Server Always On,然後使用 Windows 叢集指派接聽程式。They configure SQL Server Always On by using SQL Server Management Studio and then assign a listener by using Windows clustering.

建立 Always On 可用性群組Create an Always On availability group

  1. 在 SQL Server Management Studio 中,他們會選取並保存 (或以滑鼠右鍵按一下) Always On 高可用性 ],以啟動 [ 新增可用性群組] WizardIn SQL Server Management Studio, they select and hold (or right-click) Always On High Availability to start the New Availability Group Wizard.

  2. 在 [ 指定選項] 中,它們會為可用性群組命名 SHAOGIn Specify Options, they name the availability group SHAOG. 在 [ 選取資料庫] 中,他們會選取 SmartHotel360 資料庫。In Select Databases, they select the SmartHotel360 database.

    顯示 [選取資料庫] 窗格的螢幕擷取畫面。

  3. 在 [ 指定複本] 中,它們會將兩個 SQL 節點新增為可用性複本,並將它們設定為使用同步認可來提供自動容錯移轉。In Specify Replicas, they add the two SQL nodes as availability replicas and configure them to provide automatic failover with synchronous commit.

    顯示 [複本] 索引標籤的螢幕擷取畫面。

  4. 他們會設定群組 (SHAOG) 和埠的接聽程式。They configure a listener for the group (SHAOG) and port. 內部負載平衡器的 IP 位址會以靜態 IP 位址的形式新增 ( 。The IP address of the internal load balancer is added as a static IP address (

    顯示 [建立可用性群組接聽程式] 選項的螢幕擷取畫面。

  5. 在 [選取資料同步處理] 中,他們啟用自動植入。In Select Data Synchronization, they enable automatic seeding. 使用此選項時,SQL Server 會自動為群組中的每個資料庫建立次要複本,因此 Contoso 不需要手動備份和還原它們。With this option, SQL Server automatically creates secondary replicas for every database in the group, so Contoso doesn't have to manually back up and restore them. 驗證之後,會建立可用性群組。After validation, the availability group is created.

    顯示 Always On 可用性群組已建立的螢幕擷取畫面。

  6. Contoso 在建立群組時發生問題。Contoso ran into an issue when creating the group. 它並未使用 Active Directory Windows 整合式安全性,而且必須授與許可權給 SQL 登入,以建立 Windows 容錯移轉叢集角色。It isn't using Active Directory Windows integrated security and needs to grant permissions to the SQL login to create the Windows failover cluster roles.

    顯示授與許可權給 SQL 登入的螢幕擷取畫面。

  7. 群組建立之後,就會出現在 SQL Server Management Studio 中。After the group is created, it appears in SQL Server Management Studio.

在叢集上設定接聽程式Configure a listener on the cluster

在設定 SQL 部署的最後一個步驟中,Contoso 管理員會將內部負載平衡器設定為叢集上的接聽程式,並使接聽程式上線。As a last step in setting up the SQL deployment, the Contoso admins configure the internal load balancer as the listener on the cluster and bring the listener online. 他們使用腳本來執行這項工作。They use a script to do this task.


驗證設定Verify the configuration

在所有設定完成後,Contoso 此時在使用移轉後資料庫的 Azure 中已有可運作的可用性群組。With everything set up, Contoso now has a functional availability group in Azure that uses the migrated database. 系統管理員會在 SQL Server Management Studio 中連接到內部負載平衡器,以驗證設定。The admins verify the configuration by connecting to the internal load balancer in SQL Server Management Studio.


需要其他協助?Need more help?

步驟9:使用 Azure 遷移遷移 VMStep 9: Migrate the VM with Azure Migrate

Contoso 管理員會執行快速測試容錯移轉,然後遷移 VM。The Contoso admins run a quick test failover and then migrate the VM.

執行測試移轉Run a test migration

執行測試遷移有助於確保一切在遷移前都能如預期般運作。Running a test migration helps ensure that everything's working as expected before the migration. Contoso 管理員:The Contoso admins:

  1. 執行測試容錯移轉至最新的可用時間點 (Latest processed) 。Run a test failover to the latest available point in time (Latest processed).

  2. 選取 [ 先將機器關機再開始容錯移轉 ],讓 Azure 遷移嘗試先關閉來源 VM,再觸發容錯移轉。Select Shut down machine before beginning failover so that Azure Migrate attempts to shut down the source VM before triggering the failover. 即使關機失敗,仍會繼續容錯移轉。Failover continues even if shutdown fails.

  3. 測試容錯移轉會執行:A test failover runs:

    • 系統會執行先決條件檢查,以確保所有移轉所需的條件都已準備就緒。A prerequisites check runs to make sure all of the conditions required for migration are in place.
    • 容錯移轉會處理資料,以便建立 Azure VM。Failover processes the data so that an Azure VM can be created. 如果選取了最新的復原點,則會根據資料建立復原點。If the latest recovery point is selected, a recovery point is created from the data.
    • 使用上一個步驟中處理的資料建立 Azure VM。An Azure VM is created by using the data processed in the previous step.
  4. 容錯移轉完成後,Azure VM 複本會出現在 Azure 入口網站中。After the failover finishes, the replica Azure VM appears in the Azure portal. 他們會確認 VM 為適當的大小、其已連線到正確的網路,而且正在執行中。They check that the VM is the appropriate size, that it's connected to the right network, and that it's running.

  5. 確認之後,他們可以清除容錯移轉,並記錄與儲存任何觀察到的結果。After verifying, they clean up the failover, and record and save any observations.

執行容錯移轉Run a failover

  1. 驗證測試容錯移轉如預期般運作之後,他們會建立復原計畫來進行遷移,並新增 WEBVM 至方案。After verifying that the test failover worked as expected, they create a recovery plan for migration, and add WEBVM to the plan.


  2. 他們根據此計畫執行容錯移轉。They run a failover on the plan. 他們會選取最新的復原點。They select the latest recovery point. 他們會指定 Azure 遷移應該在觸發容錯移轉之前,先嘗試關閉內部部署 VM。They specify that Azure Migrate should try to shut down the on-premises VM before triggering the failover.

    顯示 [容錯移轉] 窗格的螢幕擷取畫面。

  3. 容錯移轉之後,他們可以確認 Azure VM 會如預期般出現在 Azure 入口網站中。After the failover, they verify that the Azure VM appears as expected in the Azure portal.

    顯示虛擬機器的 [總覽] 窗格的螢幕擷取畫面。

  4. 在 Azure 中確認 VM 之後,他們會完成遷移以完成遷移程式、停止 VM 複寫,以及停止 Azure 遷移 VM 的計費。After verifying the VM in Azure, they complete the migration to finish the migration process, stop replication for the VM, and stop Azure Migrate billing for the VM.


更新連接字串Update the connection string

在遷移程式的最後一個步驟中,Contoso 管理員會將應用程式的連接字串更新為指向在接聽程式上執行的遷移後資料庫 SHAOGAs the final step in the migration process, the Contoso admins update the connection string of the application to point to the migrated database running on the SHAOG listener. 這項設定會在現在於 Azure 中執行的上變更 WEBVMThis configuration will be changed on the WEBVM now running in Azure. 這項設定位於 web.config ASP.NET 應用程式的中。This configuration is located in the web.config of the ASP.NET application.

  1. Contoso 管理員會在中找到檔案 C:\inetpub\SmartHotelWeb\web.config ,並變更伺服器的名稱,以反映 Always On 可用性群組的 FQDN: shaog.contoso.comThe Contoso admins locate the file at C:\inetpub\SmartHotelWeb\web.config and change the name of the server to reflect the FQDN of the Always On availability group: shaog.contoso.com.

    顯示 Always On 可用性群組 FQDN 的螢幕擷取畫面。

  2. 更新檔案並加以儲存後,就會重新開機 IIS WEBVMAfter updating the file and saving it, they restart IIS on WEBVM. 它們會 iisreset /restart 從命令提示字元使用。They use iisreset /restart from a command prompt.

  3. 重新開機 IIS 之後,應用程式現在會使用在受控實例上執行的資料庫。After IIS is restarted, the application now uses the database running on the managed instance.

需要其他協助?Need more help?

移轉之後進行清除Clean up after migration

在遷移之後,SmartHotel360 應用程式會在 Azure VM 上執行。After migration, the SmartHotel360 application is running on an Azure VM. SmartHotel360 資料庫位於 Azure 中的 SQL Server 叢集中。The SmartHotel360 database is located in the SQL Server cluster in Azure.

現在,Contoso 必須完成這些清除步驟:Now, Contoso needs to finish these cleanup steps:

  • 從 vCenter 清查中移除內部部署 VM。Remove the on-premises VMs from the vCenter inventory.
  • 從本機備份作業中移除 VM。Remove the VMs from local backup jobs.
  • 更新內部文件以顯示 VM 的新位置和 IP 位址。Update internal documentation to show the new locations and IP addresses for VMs.
  • 檢閱與已解除委任 VM 互動的任何資源。Review any resources that interact with the decommissioned VMs. 更新任何相關的設定或文件,以反映新的組態。Update any relevant settings or documentation to reflect the new configuration.
  • 新增兩個新的 Vm (SQLAOG1 ,並 SQLAOG2) 到生產監視系統。Add the two new VMs (SQLAOG1 and SQLAOG2) to production monitoring systems.

檢閱部署Review the deployment

對於 Azure 中的遷移後資源,Contoso 必須能執行一切功能並保護其新的基礎結構。With the migrated resources in Azure, Contoso needs to fully operationalize and secure its new infrastructure.


Contoso 安全性小組會檢查虛擬機器 WEBVMSQLAOG1 和, SQLAOG2 以判斷任何安全性問題。The Contoso security team reviews the virtual machines WEBVM, SQLAOG1, and SQLAOG2 to determine any security issues. 他們必須:They need to:

  • 檢查 (Nsg) 的網路安全性群組,讓 VM 控制存取權。Review the network security groups (NSGs) for the VM to control access. NSG 可用來確保只可以傳遞該應用程式允許的流量。NSGs are used to ensure that only traffic allowed to the application can pass.
  • 請考慮使用 Azure 磁片加密和 Azure Key Vault 來保護磁片上的資料。Consider securing the data on the disk by using Azure Disk Encryption and Azure Key Vault.
  • 評估透明資料加密。Evaluate transparent data encryption. 然後在新的 Always On 可用性群組上執行的 SmartHotel360 資料庫上啟用它。Then enable it on the SmartHotel360 database running on the new Always On availability group. 深入瞭解 透明資料加密Learn more about transparent data encryption.

如需詳細資訊,請參閱 Azure 中 IaaS 工作負載的安全性最佳作法For more information, see Security best practices for IaaS workloads in Azure.

商務持續性和災害復原Business continuity and disaster recovery

針對商務持續性和災害復原,Contoso 會採取下列動作:For business continuity and disaster recovery, Contoso takes the following actions:

授權和成本最佳化Licensing and cost optimization

  • Contoso 具有其現有的授權 WEBVM ,並將利用 Azure 混合式權益。Contoso has existing licensing for its WEBVM and will take advantage of the Azure Hybrid Benefit. Contoso 會轉換現有的 Azure VM,以便充分利用這個定價。Contoso will convert the existing Azure VMs to take advantage of this pricing.
  • Contoso 會使用 Azure 成本管理 + 計費 來確保公司維持在 IT 領導階層所建立的預算內。Contoso will use Azure Cost Management + Billing to ensure the company stays within budgets established by the IT leadership.


在本文中,Contoso 會在 Azure 中重新裝載 SmartHotel360 應用程式,方法是使用 Azure 遷移將應用程式前端 VM 遷移至 Azure。In this article, Contoso rehosted the SmartHotel360 application in Azure by migrating the application front-end VM to Azure by using Azure Migrate. Contoso 會使用 Azure 資料庫移轉服務,將應用程式資料庫移轉至在 Azure 中布建的 SQL Server 叢集,並在 SQL Server Always On 可用性群組中加以保護。Contoso migrated the application database to a SQL Server cluster provisioned in Azure by using Azure Database Migration Service and protected it in a SQL Server Always On availability group.