Azure 中登陸區域的測試導向開發Test-driven development for landing zones in Azure

如同上一篇有關 測試導向開發 (TDD) 針對登陸區域所述,tdd 迴圈開始的測試會驗證傳遞雲端採用計畫所需之特定功能的接受準則。As outlined in the previous article on test-driven development (TDD) for landing zones, TDD cycles begin with a test that validates the acceptance criteria of a specific feature required to deliver the cloud adoption plan. 然後,您可以測試登陸區域的展開或重構,以驗證是否符合接受準則。Expanding or refactoring the landing zone can then be tested to validate that the acceptance criteria have been met. 本文概述 Azure 中的雲端原生工具鏈,以自動化測試導向的開發週期。This article outlines a cloud-native toolchain in Azure to automate test-driven development cycles.

支援登陸區域 TDD 週期的 Azure 工具Azure tools to support landing zone TDD cycles

Azure 中的測試導向開發工具

圖1: Azure 中的測試驅動開發工具。Figure 1: Test-driven development tools in Azure.

Azure 原生治理產品和服務的工具鏈可以輕鬆地整合到測試導向開發,以建立登陸區域。The toolchain of Azure-native governance products and services can be easily integrated into test-driven development for the creation of landing zones. 這些工具每一個都有特定用途,讓您更容易開發、測試及部署登陸區域,以配合 TDD 週期進行調整。Each of these tools serves a specific purpose, making it easier to develop, test, and deploy your landing zone in alignment with TDD cycles.

Microsoft 提供的測試和部署範本,以加速 TDDMicrosoft-provided test and deployment templates to accelerate TDD

下列範例是由 Microsoft 提供,用於治理用途。The following examples are provided by Microsoft for governance purposes. 每個都可用來做為登陸區域的測試導向開發週期中的測試或一系列測試。Each can be used as a test or series of tests in a test-driven development cycle for landing zones. 下列各節提供有關每個工具的詳細資訊:The following sections provide more information on each tool:

  • Azure 藍圖提供各種 藍圖範例,包括用於測試的原則,以及用於部署的範本。Azure Blueprints provides various blueprint samples, including policies for testing and templates for deployment. 這些藍圖範例可以加速在 TDD 週期中的開發、部署和測試工作。These blueprint samples can accelerate development, deployment, and testing efforts in TDD cycles.
  • Azure 原則也包含 內建原則方案,可用來測試並強制執行登陸區域完成的完整定義。Azure Policy also includes built-in policy initiatives, which could be used to test and enforce the full definition of done for a landing zone. Azure 原則包含內 建原則定義 ,這些定義可以符合完成定義內的個別接受準則。Azure Policy includes built-in policy definitions that can meet individual acceptance criteria within the definition of done.
  • Azure Graph 包含 advanced query 範例,可用來瞭解如何在登陸區域內部署工作負載,以進行先進的測試案例。Azure Graph includes advanced query samples, which can be used to understand how the workloads are deployed within a landing zone for advanced testing scenarios.
  • Azure 快速入門範本 提供原始程式碼範本,可協助加速登陸區域和工作負載部署。Azure quickstart templates provides of source code templates to aid in accelerating landing zone and workload deployment.

上面所列的範例可作為加速 TDD 週期的工具。The examples listed above can be used as tools for accelerating TDD cycles. 他們會在下列各節中的治理工具上執行,並允許雲端平臺小組建立自己的原始程式碼和測試。They run on the governance tools in the following sections and allow cloud platform teams to create their own source code and tests.

可加快 TDD 週期的 Azure 治理工具Azure governance tools that can accelerate TDD cycles

Azure 原則:部署或嘗試部署偏離治理原則時,Azure 原則可以提供自動化的偵測、保護和解決方式。Azure Policy: When deployments or attempted deployments deviate from governance policies, Azure Policy can provide automated detection, protection, and resolution. 但 Azure 原則也提供在完成定義中測試驗收準則的主要機制。But Azure Policy also provides the primary mechanism for testing acceptance criteria in your definition of done. 在 TDD 迴圈中,您可以建立原則定義來測試單一接受準則。In a TDD cycle, a policy definition can be created to test a single acceptance criteria. 同樣地,所有驗收準則都可以新增至指派給整個訂用帳戶的原則方案。Likewise, all acceptance criteria can be added to a policy initiative assigned to the entire subscription. 這種方法會在修改登陸區域之前,提供 red 測試的機制。This approach provides a mechanism for red tests before modifying the landing zone. 一旦登陸區域符合完成的定義之後,就可以使用它來強制執行測試準則,以避免在未來的版本中導致測試失敗的程式碼變更。Once the landing zone meets the definition of done, it can be used to enforce the test criteria to avoid code changes that would cause the test to fail in future releases.

Azure 藍圖: Azure 藍圖會將原則和其他部署工具組合成可重複使用的套件,以指派給多個登陸區域。Azure Blueprints: Azure blueprint groups policies and other deployment tools into a repeatable package that can be assigned to multiple landing zones. 當多個採用工作共用完成的一般定義時(您可能會想要隨著時間進行更新),藍圖證明很有用。Blueprints prove useful when multiple adoption efforts share common definitions of done, which you may want to update over time. 它也可以在後續努力擴充和重構登陸區域時協助進行部署。It can also help with deployment during subsequent efforts to expand and refactor landing zones.

Azure Resource Graph: Resource Graph 提供查詢語言,以根據登陸區域內部署的資產相關資訊來建立資料驅動的測試。Azure Resource Graph: Resource Graph provides a query language for creating data-driven tests based on information about the assets deployed within a landing zone. 在後續的採用方案中,此工具也可以根據工作負載資產與基礎雲端環境之間的互動,來定義複雜的測試。Later in the adoption plan, this tool can also define complex tests based on the interactions between workload assets and the underlying cloud environment.

Azure Resource Manager 範本:這些範本可為 Azure 中部署的任何環境提供主要原始程式碼。Azure Resource Manager templates: These templates provide the primary source code for any environment deployed in Azure. 某些協力廠商工具(例如 Terraform)會產生自己的 ARM 範本,然後提交給 Azure Resource Manager。Some third-party tools like Terraform generate their own ARM templates, which are then submitted to Azure Resource Manager.

Azure Resource Manager: Resource Manager 為組建和部署功能提供一致的平臺。Azure Resource Manager: Resource Manager provides a consistent platform for build and deploy functions. 這個平臺可以根據原始程式碼定義來部署登陸區域。This platform can deploy landing zones based on source code definitions.

後續步驟Next steps

若要開始重構您的第一個登陸區域,請評估 基本登陸區域考慮To begin refactoring your first landing zone, evaluate basic landing zone considerations.