將 Team Foundation Server 部署重構到 Azure DevOps ServicesRefactor a Team Foundation Server deployment to Azure DevOps Services

本文說明虛構公司 Contoso 如何將其內部部署 Team Foundation Server (TFS) 部署遷移至 Azure 中的 Azure DevOps Services,以進行重構。This article shows how the fictional company Contoso refactors their on-premises Team Foundation Server (TFS) deployment by migrating it to Azure DevOps Services in Azure. Contoso 開發小組已使用 TFS 進行小組共同作業,並在過去五年進行原始檔控制。The Contoso development team has used TFS for team collaboration and source control for the past five years. 現在,他們想要移轉至雲端式解決方案以進行開發和測試工作,以及原始檔控制。Now, they want to move to a cloud-based solution for dev and test work, and for source control. 當他們移轉至 Azure DevOps 模型,並開發新的雲端原生應用程式時,Azure DevOps Services 將扮演重要角色。Azure DevOps Services will play a role as they move to an Azure DevOps model, and develop new cloud-native apps.

商業動機Business drivers

IT 領導小組與商務夥伴密切合作,試圖找出未來的目標。The IT Leadership team has worked closely with business partners to identify future goals. 商業夥伴並不太擔心開發工具和技術,但是他們歸納出以下幾點:Partners aren't overly concerned with dev tools and technologies, but they have captured these points:

  • 軟體: 無論核心業務為何,所有公司現在都是軟體公司,包括 Contoso 在內。Software: Regardless of the core business, all companies are now software companies, including Contoso. 企業領導者想知道 IT 如何引領公司為使用者提供嶄新的工作方式,以及新的客戶體驗。Business leadership is interested in how IT can help lead the company with new working practices for users, and experiences for their customers.
  • 效率: Contoso 必須為開發人員和使用者簡化處理常式,並移除不必要的程式。Efficiency: Contoso needs to streamline process and remove unnecessary procedures for developers and users. 這可讓公司更有效率地達到客戶的要求。This will allow the company to deliver on customer requirements more efficiently. 企業需要的是快速、但不浪費時間或金錢的 IT。The business needs IT to fast, without wasting time or money.
  • 靈活性: Contoso IT 必須回應商務需求,並以更快的速度回應,以實現全球經濟的成效。Agility: Contoso IT needs to respond to business needs, and react more quickly than the marketplace to enable success in a global economy. IT 不可成為企業的絆腳石。IT mustn't be a blocker for the business.

移轉目標Migration goals

Contoso 雲端小組已擬定好移轉至 Azure DevOps Services 的目標:The Contoso cloud team has pinned down goals for the migration to Azure DevOps Services:

  • 小組需要將資料遷移至雲端的工具。The team needs a tool to migrate the data to the cloud. 有幾項程序必須手動執行。Few manual processes should be needed.
  • 他們必須移轉去年的工作項目資料和歷程記錄。Work item data and history for the last year must be migrated.
  • 他們不想設定新的使用者名稱和密碼。They don't want to set up new user names and passwords. 目前的所有系統指派都必須保留。All current system assignments must be maintained.
  • 他們想要從 Team Foundation 版本控制 (TFVC) 移轉至 Git,以進行原始檔控制。They want to move away from Team Foundation Version Control (TFVC) to Git for source control.
  • 轉換至 Git 將會是「tip 遷移」,只會匯入最新版本的原始程式碼。The transition to Git will be a "tip migration" that imports only the latest version of the source code. 當程式碼基底轉移後,所有工作都會停止時,就會在停機期間發生。It will happen during a downtime when all work will be halted as the code base shifts. 他們了解,在移動之後,將只有目前的主要分支歷程記錄可供使用。They understand that only the current master branch history will be available after the move.
  • 他們想知道會有何變更,並且想在進行完整的移轉之前先進行測試。They're concerned about the change and want to test it before doing a full move. 他們想在移轉至 Azure DevOps Services 之後仍保留對 TFS 的存取。They want to retain access to TFS even after the move to Azure DevOps Services.
  • 他們有多個集合,但是想先從只有幾個專案的集合開始嘗試,以進一步了解程序。They have multiple collections, and want to start with one that has only a few projects to better understand the process.
  • 他們了解 TFS 集合具有與 Azure DevOps Services 組織間的一對一關聯性,因此會有多個 URL。They understand that TFS collections are a one-to-one relationship with Azure DevOps Services organizations, so they'll have multiple URLs. 不過,這與他們目前程式碼基底和專案分離的模型相符。However, this matches their current model of separation for code bases and projects.

建議的架構Proposed architecture

  • Contoso 會將其 TFS 專案移至雲端,並不會再將其專案或原始檔控制裝載於內部部署。Contoso will move their TFS projects to the cloud, and no longer host their projects or source control on-premises.
  • TFS 將會遷移至 Azure DevOps Services。TFS will be migrated to Azure DevOps Services.
  • Contoso 目前有一個名為 ContosoDev 的 TFS 集合,將會遷移至稱為 contosodevmigration.visualstudio.com 的 Azure DevOps Services 組織。Currently Contoso has one TFS collection named ContosoDev, which will be migrated to an Azure DevOps Services organization called contosodevmigration.visualstudio.com.
  • 去年的專案、工作項目、錯誤 (bug) 和反覆項目將會遷移至 Azure DevOps Services。The projects, work items, bugs and iterations from the last year will be migrated to Azure DevOps Services.
  • Contoso 將會使用他們在移轉規劃之初部署其 Azure 基礎結構時所設定的 Azure Active Directory。Contoso will use their Azure Active Directory, which they set up when they deployed their Azure infrastructure at the beginning of their migration planning.

案例架構

移轉程序Migration process

Contoso 會按照下列方式完成移轉程序:Contoso will complete the migration process as follows:

  1. 相關準備工作非常多。There's a lot of preparation involved. 首先,Contoso 必須將其 TFS 實作升級至支援的層級。As a first step, Contoso needs to upgrade their TFS implementation to a supported level. Contoso 目前執行 TFS 2017 Update 3,但若要使用資料庫移轉,就必須執行受支援且具有最新更新的 2018 版。Contoso is currently running TFS 2017 Update 3, but to use database migration it needs to run a supported 2018 version with the latest updates.
  2. 升級之後,Contoso會執行 TFS 移轉工具,並驗證其集合。After upgrading, Contoso will run the TFS migration tool, and validate their collection.
  3. Contoso 會建置一組準備檔案,並執行移轉的試執行以進行測試。Contoso will build a set of preparation files, and perform a migration dry run for testing.
  4. 然後,Contoso 會執行另一項移轉,這次將是包含工作項目、Bug、衝刺和程式碼的完整移轉。Contoso will then run another migration, this time a full migration that includes work items, bugs, sprints, and code.
  5. 在移轉之後,Contoso 會將程式碼從 TFVC 移至 Git。After the migration, Contoso will move their code from TFVC to Git.

移轉程序

PrerequisitesPrerequisites

以下是 Contoso 要執行此案例所需的項目。Here's what Contoso needs to run this scenario.

需求Requirements 詳細資料Details
Azure 訂用帳戶Azure subscription Contoso 已在本系列稍早的文章中建立訂用帳戶。Contoso created subscriptions 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, you need to work with the admin to assign you Owner or Contributor permissions.

如果您需要更細微的權限,請檢閱此文章If you need more granular permissions, review this article.
Azure 基礎結構Azure infrastructure Contoso 會如適用於移轉的 Azure 基礎結構中所述,設定其 Azure 基礎結構。Contoso set up their Azure infrastructure as described in Azure infrastructure for migration.
內部部署 TFS 伺服器On-premises TFS server 內部部署必須在此過程中執行或升級為 TFS 2018 Upgrade 2。On-premises need to either be running TFS 2018 Upgrade 2 or be upgraded to it as part of this process.

案例步驟Scenario steps

以下是 Contoso 完成移轉的方式:Here's how Contoso will complete the migration:

  • 步驟1:建立 Azure 儲存體帳戶。Step 1: Create an Azure storage account. 在移轉程序期間將使用此儲存體帳戶。This storage account will be used during the migration process.
  • 步驟2:升級 TFS。Step 2: Upgrade TFS. Contoso 會將其部署升級至 TFS 2018 Upgrade 2。Contoso will upgrade their deployment to TFS 2018 Upgrade 2.
  • 步驟3:驗證集合。Step 3: Validate collection. 為了準備移轉,Contoso 會驗證 TFS 集合。Contoso will validate the TFS collection in preparation for migration.
  • 步驟4:組建準備檔案。Step 4: Build preparation file. Contoso 會使用 TFS 移轉工具建立移轉檔案。Contoso will create the migration files using the TFS Migration Tool.

步驟 1:建立儲存體帳戶Step 1: Create a storage account

  1. 在 Azure 入口網站中,Contoso 管理員會建立儲存體帳戶 (contosodevmigration)。In the Azure portal, Contoso admins create a storage account (contosodevmigration).

  2. 他們將這些帳戶放在用於容錯移轉的次要區域中 - 美國中部。They place the account in their secondary region they use for failover - Central US. 他們使用具有本機備援儲存體的一般用途標準帳戶。They use a general-purpose standard account with locally redundant storage.

    儲存體帳戶

需要其他協助?Need more help?

步驟 2:升級 TFSStep 2: Upgrade TFS

Contoso 管理員會將 TFS 伺服器升級至 TFS 2018 Update 2。Contoso admins upgrade the TFS server to TFS 2018 Update 2. 在他們開始之前:Before they start:

他們會依照下列方式進行升級:They upgrade as follows:

  1. 首先,他們會備份其 TFS 伺服器 (執行於 VMware VM),並建立 VMware 快照集。To start, they back up their TFS server (running on a VMware vM) and take a VMware snapshot.

    TFS

  2. TFS 安裝程式啟動後,他們會選擇安裝位置。The TFS installer starts, and they choose the install location. 安裝程式需要存取網際網路。The installer needs internet access.

    TFS

  3. 安裝完成後,會啟動 [伺服器組態精靈]。After the installation finishes, the Server Configuration Wizard starts.

    TFS

  4. 驗證之後,精靈會完成升級。After verification, the Wizard completes the upgrade.

    TFS

  5. 他們會檢閱專案、工作項目和程式碼,以驗證 TFS 安裝。They verify the TFS installation by reviewing projects, work items, and code.

    TFS

注意

在執行某些 TFS 升級時,必須在升級完成後執行 [設定功能精靈]。Some TFS upgrades need to run the Configure Features Wizard after the upgrade completes. 詳細資訊Learn more.

需要其他協助?Need more help?

了解如何升級 TFSLearn about upgrading TFS.

步驟 3:驗證 TFS 集合Step 3: Validate the TFS collection

Contoso 管理員會對 ContosoDev 集合資料庫執行 TFS 移轉工具而加以驗證,再進行移轉。Contoso admins run the TFS Migration Tool against the ContosoDev collection database to validate it before migration.

  1. 他們會下載並解壓縮 TFS 移轉工具They download and unzip the TFS Migration Tool. 務必要下載要執行的 TFS 更新適用的版本。It's important to download the version for the TFS update that's running. 他們可在管理主控台中檢查版本。The version can be checked in the admin console.

    TFS

  2. 他們會指定專案集合的 URL 並執行此工具,以執行驗證:They run the tool to perform the validation, by specifying the URL of the project collection:

     `TfsMigrator validate /collection:http://contosotfs:8080/tfs/ContosoDev`
    
  3. 此工具會顯示錯誤。The tool shows an error.

    TFS

  4. 他們在工具所在位置上一層的 Logs 資料夾中找到記錄。They located the log files are located in the Logs folder, just before the tool location. 每個主要驗證都會產生一個記錄檔。A log file is generated for each major validation. TfsMigration.log 包含主要資訊。TfsMigration.log holds the main information.

    TFS

  5. 他們會尋找這個與身分識別有關的項目。They find this entry, related to identity.

    TFS

  6. 他們在命令列上執行 TfsMigrator validate /help,並發現似乎必須執行 /tenantDomainName 命令,才能驗證身分識別。They run TfsMigrator validate /help at the command line, and see that the command /tenantDomainName seems to be required to validate identities.

    TFS

  7. 他們再次執行驗證命令,並包含此值,以及他們的 Azure AD 名稱:TfsMigrator validate /collection: http://contosotfs:8080/tfs/ContosoDev /tenantDomainName:contosomigration.onmicrosoft.comThey run the validation command again, and include this value, along with their Azure AD name: TfsMigrator validate /collection:http://contosotfs:8080/tfs/ContosoDev /tenantDomainName:contosomigration.onmicrosoft.com.

    TFS

  8. Azure AD 登入畫面出現後,他們輸入全域管理員使用者的認證。An Azure AD sign-in screen appears, and they enter the credentials of a Global Admin user.

    TFS

  9. 驗證會通過,並由工具確認。The validation passes and is confirmed by the tool.

    TFS

步驟 4:建立移轉檔案Step 4: Create the migration files

驗證完成後,Contoso 管理員即可使用 TFS 移轉工具建置移轉檔案。With the validation complete, Contoso admins can use the TFS Migration Tool to build the migration files.

  1. 他們在此工具中執行準備步驟。They run the prepare step in the tool.

    TfsMigrator prepare /collection:http://contosotfs:8080/tfs/ContosoDev /tenantDomainName:contosomigration.onmicrosoft.com /accountRegion:cus

    準備

    執行的準備工作如下:Prepare does the following:

    • 掃描集合以找出所有使用者的清單,並填入身分識別對應記錄 (IdentityMapLog.csv)。Scans the collection to find a list of all users and populates the identify map log (IdentityMapLog.csv).
    • 準備連線至 Azure Active Directory,以尋找每個身分識別的相符項目。Prepares the connection to Azure Active Directory to find a match for each identity.
    • Contoso 已部署 Azure AD 並使用 Azure AD Connect 加以同步處理,因此「準備工作」應可找到相符的身分識別,並將其標示為「作用中」。Contoso has already deployed Azure AD and synchronized it using Azure AD Connect, so Prepare should be able to find the matching identities and mark them as Active.
  2. Azure AD 登入畫面出現後,他們輸入全域管理員的認證。An Azure AD sign-in screen appears, and they enter the credentials of a Global Admin.

    準備

  3. 準備完成後,此工具會報告已順利產生匯入檔案。Prepare completes, and the tool reports that the import files have been generated successfully.

    準備

  4. 此時,他們會看到 IdentityMapLog.csv 和 import.json 檔案已建立於新資料夾中。They can now see that both the IdentityMapLog.csv and the import.json file have been created in a new folder.

    準備

  5. Import.json 檔案會提供匯入設定。The import.json file provides import settings. 其中包含所需組織名稱之類的資訊,以及儲存體帳戶資訊。It includes information such as the desired organization name, and storage account information. 大部分的欄位會自動填入。Most of the fields are populated automatically. 某些欄位需由使用者輸入。Some fields required user input. Contoso 會開啟檔案,並新增要建立的 Azure DevOps Services 組織名稱:contosodevmigrationContoso opens the file, and adds the Azure DevOps Services organization name to be created: contosodevmigration. 使用此名稱時,其 Azure DevOps Services URL 將是 contosodevmigration.visualstudio.comWith this name, their Azure DevOps Services URL will be contosodevmigration.visualstudio.com.

    準備

    注意

    組織必須在移轉之前建立,並且可在移轉完成後變更。The organization must be created before the migration, It can be changed after migration is done.

  6. 他們檢閱身分識別記錄對應檔,其中顯示將在匯入期間移至 Azure DevOps Services 的帳戶。They review the identity log map file that shows the accounts that will be brought into Azure DevOps Services during the import.

    • 作用中的身分識別是指在匯入後會在 Azure DevOps Services 中成為使用者的身分識別。Active identities refer to identities that will become users in Azure DevOps Services after the import.
    • 在移轉之後,這些身分識別將在 Azure DevOps Services 上獲得授權,並且顯示為組織中的使用者。On Azure DevOps Services, these identities will be licensed, and show up as a user in the organization after migration.
    • 這些身分識別檔案的 [預期的匯入狀態] 資料行中會標示 [作用中]。These identities are marked as Active in the Expected Import Status column in the file.

    準備

步驟 5:遷移至 Azure DevOps ServicesStep 5: Migrate to Azure DevOps Services

在準備就緒後,Contoso 管理員此時已可專注於移轉工作。With preparation in place, Contoso admins can now focus on the migration. 執行移轉之後,他們會從使用 TFVC 改為使用 Git,以進行版本控制。After running the migration, they'll switch from using TFVC to Git for version control.

在開始之前,管理員會排定開發小組的停機時間,使集合離線以進行移轉。Before they start, the admins schedule downtime with the dev team, to take the collection offline for migration. 以下是移轉程序的步驟:These are the steps for the migration process:

  1. 中斷集合的連結。Detach the collection. 當集合已連結且連線時,集合的身分識別資料會位於 TFS 伺服器設定資料庫中。Identity data for the collection resides in the TFS server configuration database while the collection is attached and online. 當集合從 TFS 伺服器中斷連結時,它會取得該身分識別資料的複本,並將它封裝於集合以進行傳輸。When a collection is detached from the TFS server, it takes a copy of that identity data, and packages it with the collection for transport. 若沒有這項資料,則無法執行匯入的身分識別部分。Without this data, the identity portion of the import cannot be executed. 建議應在匯入完成前讓集合持續中斷連結,因為在匯入期間發生的變更是無法匯入的。It's recommended that the collection stay detached until the import has been completed, as there's no way to import the changes which occurred during the import.
  2. 產生備份。Generate a backup. 移轉程序的下一個步驟,是產生可匯入 Azure DevOps Services 中的備份。The next step of the migration process is to generate a backup that can be imported into Azure DevOps Services. 資料層應用程式元件封裝 (DACPAC) 是一項 SQL Server 功能,可讓資料庫變更封裝成單一檔案,並部署至其他 SQL 執行個體。Data-tier Application Component Packages (DACPAC), is a SQL Server feature that allows database changes to be packaged into a single file, and deployed to other instances of SQL. 它也可以直接還原至 Azure DevOps Services,並做為將集合資料放入雲端的封裝方法。It can also be restored directly to Azure DevOps Services, and it is used as the packaging method for getting collection data into the cloud. Contoso 會使用 SqlPackage.exe 工具來產生 DACPAC。Contoso will use the SqlPackage.exe tool to generate the DACPAC. 此工具隨附於 SQL Server Data Tools 中。This tool is included in SQL Server Data Tools.
  3. 上傳至儲存體。Upload to storage. 建立 DACPAC 之後,他們將它上傳到 Azure 儲存體。After the DACPAC is created, they upload it to Azure Storage. 上傳之後,他們會取得共用存取簽章 (SAS),以允許 TFS 移轉工具存取儲存體。After it's uploaded, they get a shared access signature (SAS), to allow the TFS Migration Tool access to the storage.
  4. 填寫匯入。Fill out the import. 接著,Contoso 可以在匯入檔案中填寫遺漏的欄位,包括 DACPAC 設定。Contoso can then fill out missing fields in the import file, including the DACPAC setting. 為此,他們會先指定要進行試執行匯入,以確認一切都正常運作,再進行完整移轉。To start with they'll specify that they want to do a dry run import, to check that everything's working properly before the full migration.
  5. 試執行。Do a dry run. 試執行匯入,以協助測試集合移轉。Dry run imports help test collection migration. 試執行的生命週期有限,因此它們會在生產環境遷移執行之前遭到刪除。Dry runs have limited life, so they're deleted before a production migration runs. 試執行會在一段時間後自動刪除。They're deleted automatically after a set duration. 在匯入完成後收到成功電子郵件中,會包含何時將刪除試執行的相關附註。A note about when the dry run will be deleted is included in the success email received after the import finishes. 請記下該時間並據以進行規劃。Take note and plan accordingly.
  6. 完成生產環境移轉。Complete the production migration. 在試執行移轉完成後,Contoso 管理員會更新 import.json 檔案,並再次執行匯入,以進行最後的移轉。With the dry run migration completed, Contoso admins do the final migration by updating the import.json file, and running import again.

中斷集合的連結Detach the collection

開始之前,Contoso 管理員會先建立本機 SQL Server 備份,並建立 TFS 伺服器的 VMware 快照集,再中斷連結。Before starting, Contoso admins take a local SQL Server backup, and VMware snapshot of the TFS server, before detaching.

  1. 在 TFS 管理主控台中,他們會選取要中斷連結的集合 (ContosoDev)。In the TFS Admin console, they select the collection they want to detach (ContosoDev).

    遷移

  2. 在 [一般] 中,他們選取 [中斷連結集合]。In General, they select Detach Collection.

    遷移

  3. 在 [中斷連結 Team 專案集合精靈] > [服務訊息] 中,他們為可能嘗試對集合中的專案進行連線的使用者提供訊息。In the Detach Team Project Collection Wizard > Servicing Message, they provide a message for users who might try to connect to projects in the collection.

    遷移

  4. 在卸離進度中,他們會監視進度,然後在處理完成時選取 [下一步]In Detach Progress, they monitor progress and then select Next when the process finishes.

    遷移

  5. 在 [整備檢查] 中,他們在檢查完成後執行 [中斷連結]。In Readiness Checks, when checks finish they select Detach.

    遷移

  6. 他們會選取 [關閉] 以完成作業。They select Close to finish up.

    遷移

  7. TFS 管理主控台已不再參考該集合。The collection is no longer referenced in the TFS Admin console.

    遷移

產生 DACPACGenerate a DACPAC

Contoso 會建立可匯入 Azure DevOps Services 中的備份 (DACPAC)。Contoso creates a backup (DACPAC) for import into Azure DevOps Services.

  • SQL Server Data Tools 中的 SqlPackage.exe 會用來建立 DACPAC。SqlPackage.exe in SQL Server Data Tools is used to create the DACPAC. SQL Server Data Tools 安裝了多個版本的 SqlPackage,其位於資料夾中,名稱如120、130和140。There are multiple versions of SqlPackage.exe installed with SQL Server Data Tools, located under folders with names like 120, 130, and 140. 務必要使用正確的版本來準備 DACPAC。It's important to use the right version to prepare the DACPAC.

  • TFS 2018 匯入需要使用 140 資料夾中的 SqlPackage.exe 或更高版本。TFS 2018 imports need to use SqlPackage.exe from the 140 folder or higher. 若為 CONTOSOTFS,此檔案位於: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\140For CONTOSOTFS, this file is located in: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\140

Contoso 管理員會產生 DACPAC,如下所示:Contoso admins generate the DACPAC as follows:

  1. 他們會開啟命令提示字元,並瀏覽至 SQLPackage.exe 的所在位置。They open a command prompt and navigate to the SQLPackage.exe location. 他們會輸入下列命令以產生 DACPAC:They type this following command to generate the DACPAC:

    SqlPackage.exe /sourceconnectionstring:"Data Source=SQLSERVERNAME\INSTANCENAME;Initial Catalog=Tfs_ContosoDev;Integrated Security=True" /targetFile:C:\TFSMigrator\Tfs_ContosoDev.dacpac /action:extract /p:ExtractAllTableData=true /p:IgnoreUserLoginMappings=true /p:IgnorePermissions=true /p:Storage=Memory

    Backup

  2. 此命令執行後,會出現下列訊息。The following message appears after the command runs.

    Backup

  3. 他們會確認 DACPAC 檔案的屬性They verify the properties of the DACPAC file

    Backup

將檔案更新至儲存體Update the file to storage

DACPAC 建立後,Contoso 會將其上傳至 Azure 儲存體。After the DACPAC is created, Contoso uploads it to Azure Storage.

  1. 他們會下載並安裝 Azure 儲存體總管They download and install Azure Storage Explorer.

    上傳

  2. 他們會連線至其訂用帳戶,並找出他們為移轉建立的儲存體帳戶 (contosodevmigration)。They connect to their subscription and locate the storage account they created for the migration (contosodevmigration). 他們會建立新的 Blob 容器 azuredevopsmigrationThey create a new blob container, azuredevopsmigration.

    上傳

  3. 他們會以區塊 Blob 的形式指定要上傳的 DACPAC 檔案。They specify the DACPAC file for upload as a block blob.

    上傳

  4. 檔案上傳後,他們會選取檔案名稱 > [產生 SAS]。After the file is uploaded, they select the file name > Generate SAS. 他們會展開儲存體帳戶底下的 blob 容器、選取具有匯入檔案的容器,然後選取 [取得共用存取簽章]。They expand the blob containers under the storage account, select the container with the import files, then select Get Shared Access Signature.

    上傳

  5. 他們接受預設值,然後選取 [建立]。They accept the defaults, then select Create. 這可以啟用 24 小時的存取。This enables access for 24 hours.

    上傳

  6. 他們會複製共用存取簽章 URL,使其可供 TFS 移轉工具使用。They copy the Shared Access Signature URL, so that it can be used by the TFS Migration Tool.

    上傳

注意

移轉必須在允許的時間範圍內執行,否則權限將會過期。The migration must happen before within the allowed time window or permissions will expire. 請勿從 Azure 入口網站產生 SAS 金鑰。Don't generate an SAS key from the Azure portal. 以此方式產生的金鑰會以帳戶為範圍,且無法用於匯入。Keys generated like this are account-scoped, and won't work with the import.

填入匯入設定Fill in the import settings

Contoso 管理員稍早已填寫匯入規格檔案 (import.json) 的某些部分。Earlier, Contoso admins partially filled out the import specification file (import.json). 現在,他們必須新增其餘設定。Now, they need to add the remaining settings.

他們開啟 import.json 檔案,並填入下列欄位:They open the import.json file, and fill out the following fields:

  • 位置: 先前產生之 SAS 金鑰的位置。Location: Location of the SAS key that was generated above.
  • Dacpac: 將名稱設定為您上傳至儲存體帳戶的 DACPAC 檔案。Dacpac: Set the name to the DACPAC file you uploaded to the storage account. 必須包含 ".dacpac" 副檔名。Include the ".dacpac" extension.
  • ImportType: 將 [now] 設定為 [DryRun]。ImportType: Set to DryRun for now.

匯入設定

進行試執行移轉Do a dry run migration

Contoso 管理員會先進行試執行移轉,以確定一切都正常運作。Contoso admins start with a dry run migration, to make sure everything's working as expected.

  1. 他們會開啟命令提示字元,並瀏覽至 TfsMigration 所在位置 (C:\TFSMigrator)。They open a command prompt, and navigate to the TfsMigration location (C:\TFSMigrator).

  2. 第一個步驟是驗證匯入檔案。As a first step they validate the import file. 他們想要確定檔案的格式正確,且 SAS 金鑰有效用。They want to be sure the file is formatted properly, and that the SAS key is working.

    TfsMigrator import /importFile:C:\TFSMigrator\import.json /validateonly

  3. 驗證傳回錯誤,指出 SAS 金鑰需要較長的到期時間。The validation returns an error that the SAS key needs a longer expiry time.

    試執行

  4. 他們使用 Azure 儲存體總管建立新的 SAS 金鑰,且到期日設定為七天。They use Azure Storage Explorer to create a new SAS key with expiry set to seven days.

    試執行

  5. 他們會更新 import.json 檔案,並重新執行驗證。They update the import.json file and run the validation again. 這次的驗證順利完成。This time it completes successfully.

    TfsMigrator import /importFile:C:\TFSMigrator\import.json /validateonly

    試執行

  6. 他們啟動試執行:They start the dry run:

    TfsMigrator import /importFile:C:\TFSMigrator\import.json

  7. 系統發出確認移轉的訊息。A message is issued to confirm the migration. 請留意在試執行之後將保留暫存資料的時間長度。Note the length of time for which the staged data will be maintained after the dry run.

    試執行

  8. 此時會出現 Azure AD 的 [登入] 畫面,應使用 Contoso 管理員的登入資料加以完成。Azure AD Sign In appears, and should be completing with Contoso Admin sign-in.

    試執行

  9. 訊息顯示匯入的相關資訊。A message shows information about the import.

    試執行

  10. 約 15 分鐘後,他們瀏覽至 URL,並看到下列資訊:After 15 minutes or so, they browse to the URL, and see the following information:

    試執行

  11. 移轉完成後,Contoso 開發部門主管可登入 Azure DevOps Services,以確認試執行正常運作。After the migration finishes a Contoso Dev Leads signs into Azure DevOps Services to check that the dry run worked properly. 經過驗證之後,Azure DevOps Services 服務需要一些詳細資料來確認組織。After authentication, Azure DevOps Services needs a few details to confirm the organization.

    試執行

  12. 在 Azure DevOps 服務中,開發部門主管可以看到專案已遷移至 Azure DevOps Services。In Azure DevOps Services, the Dev Lead can see that the projects have been migrated to Azure DevOps Services. 有通知指出組織將在 15 天後刪除。There's a notice that the organization will be deleted in 15 days.

    試執行

  13. 開發部門主管開啟其中一個專案,並開啟 [工作項目] > [指派給我]。The Dev Lead opens one of the projects and opens Work Items > Assigned to me. 這表示工作項目資料已連同身分識別一起遷移。This shows that work item data has been migrated, along with identity.

    試執行

  14. 開發主管也會檢查其他專案和程式碼,以確認原始程式碼和歷程記錄皆已遷移。The Dev Lead also checks other projects and code, to confirm that the source code and history has been migrated.

    試執行

執行生產環境移轉Run the production migration

在試執行完成後,Contoso 管理員接著執行生產環境移轉。With the dry run complete, Contoso admins move on to the production migration. 他們會刪除試執行、更新匯入設定,然後重新執行匯入。They delete the dry run, update the import settings, and run import again.

  1. 在 Azure DevOps Services 入口網站中,他們會刪除試執行組織。In the Azure DevOps Services portal, they delete the dry run organization.

  2. 他們更新 import.json 檔案,以將 ImportType 設定為 ProductionRunThey update the import.json file to set the ImportType to ProductionRun.

    Production

  3. 他們按照試執行的步驟開始移轉:TfsMigrator import /importFile:C:\TFSMigrator\import.jsonThey start the migration as they did for the dry run: TfsMigrator import /importFile:C:\TFSMigrator\import.json.

  4. 此時會出現確認移轉的訊息,並警告資料可保留在安全的暫存區域中,最多七天。A message shows to confirm the migration, and warns that data could be held in a secure location as a staging area for up to seven days.

    Production

  5. 在 Azure AD 的 [登入] 中,他們指定 Contoso 管理員登入。In Azure AD Sign In, they specify a Contoso Admin sign-in.

    Production

  6. 訊息顯示匯入的相關資訊。A message shows information about the import.

    Production

  7. 約 15 分鐘後,他們瀏覽至 URL,並看到下列資訊:After around 15 minutes, they browse to the URL, and sees the following information:

    Production

  8. 移轉完成後,Contoso 開發部門主管可登入 Azure DevOps Services,以確認試移轉正常運作。After the migration finishes, a Contoso Dev Lead logs onto Azure DevOps Services to check that the migration worked properly. 登入之後,他可以看到專案已遷移。After login, he can see that projects have been migrated.

    Production

  9. 開發部門主管開啟其中一個專案,並開啟 [工作項目] > [指派給我]。The Dev Lead opens one of the projects and opens Work Items > Assigned to me. 這表示工作項目資料已連同身分識別一起遷移。This shows that work item data has been migrated, along with identity.

    Production

  10. 開發主管會檢查其他工作項目資料加以確認。The Dev Lead checks other work item data to confirm.

    Production

  11. 開發主管也會檢查其他專案和程式碼,以確認原始程式碼和歷程記錄皆已遷移。The Dev Lead also checks other projects and code, to confirm that the source code and history has been migrated.

    Production

將原始檔控制從 TFVC 移轉至 GITMove source control from TFVC to GIT

移轉完成後,Contoso 想要從 TFVC 移轉至 Git 以進行原始程式碼管理。With migration complete, Contoso wants to move from TFVC to Git for source code management. 他們需要將目前 Azure DevOps Services 組織中的原始程式碼匯入為相同組織中的 Git 存放庫。They need to import the source code currently in their Azure DevOps Services organization as Git repos in the same organization.

  1. 在 Azure DevOps Services 入口網站中,他們會開啟其中一個 TFVC 存放庫 ( $/PolicyConnect),並加以檢視。In the Azure DevOps Services portal, they open one of the TFVC repos ($/PolicyConnect) and review it.

    Git

  2. 他們選取 [來源] 下拉式清單 > [匯入]。They select the Source dropdown > Import.

    Git

  3. 在 [來源類型] 中,他們選取 [TFVC],並指定存放庫的路徑。In Source type they select TFVC, and specify the path to the repo. 他們決定不移轉歷程記錄。They've decided not to migrate the history.

    Git

    注意

    由於 TFVC 和 Git 儲存版本控制資訊的方式有所差異,建議 Contoso 不要遷移歷程記錄。Due to differences in how TFVC and Git store version control information, we recommend that Contoso don't migrate history. 這是 Microsoft 將 Windows 和其他產品從集中式版本控制遷移至 Git 時所採取的方法。This is the approach that Microsoft took when it migrated Windows and other products from centralized version control to Git.

  4. 匯入之後,管理員會檢閱程式碼。After the import, admins review the code.

    Git

  5. 他們會對第二個存放庫 ( $/SmartHotelContainer) 重複此程序。They repeat the process for the second repository ($/SmartHotelContainer).

    Git

  6. 檢閱來源後,開發部門主管認定移轉至 Azure DevOps Services 的作業已完成。After reviewing the source, the Dev Leads agree that the migration to Azure DevOps Services is done. Azure DevOps Services 此時已成為小組內所有涉及移轉的開發來源。Azure DevOps Services now becomes the source for all development within teams involved in the migration.

    Git

需要其他協助?Need more help?

深入了解如何從 TFVC 匯入。Learn more about importing from TFVC.

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

移轉完成後,Contoso 必須執行下列作業:With migration complete, Contoso needs to do the following:

  • 檢閱匯入之後一文,以了解其他匯入活動的相關資訊。Review the post-import article for information about additional import activities.
  • 刪除 TFVC 存放庫,或將其置於唯讀模式中。Either delete the TFVC repos, or place them in read-only mode. 不得使用程式碼基底,但可以參考其歷程記錄。The code bases mustn't used, but can be referenced for their history.

移轉後訓練Post-migration training

Contoso 將必須為相關小組成員提供 Azure DevOps Services 和 Git 訓練。Contoso will need to provide Azure DevOps Services and Git training for relevant team members.