您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

了解 Azure 蓝图的生命周期Understand the lifecycle of an Azure Blueprint

与 Azure 中的众多资源一样,Azure 蓝图中的蓝图也有一个典型的自然生命周期。Like many resources within Azure, a blueprint in Azure Blueprints has a typical and natural lifecycle. 这些蓝图会被创建、部署,并在不再需要或相关时被删除。They're created, deployed, and finally deleted when no longer needed or relevant. 蓝图支持标准的生命周期操作。Blueprints supports standard lifecycle operations. 它将在这些操作的基础之上进行构建,以提供附加的状态级别,用于支持常见的持续集成和持续部署管道,供管理基础结构即代码(DevOps 中的一项关键要素)的组织使用。It then builds upon them to provide additional levels of status that support common continuous integration and continuous deployment pipelines for organizations that manage their Infrastructure as Code – a key element in DevOps.

为了让你完全了解蓝图及其各个阶段,我们将讲解标准生命周期:To fully understand a blueprint and the stages, we'll cover a standard lifecycle:

  • 创建和编辑蓝图Creating and editing a blueprint
  • 发布蓝图Publishing the blueprint
  • 创建和编辑新版本的蓝图Creating and editing a new version of the blueprint
  • 发布新版本的蓝图Publishing a new version of the blueprint
  • 删除特定版本的蓝图Deleting a specific version of the blueprint
  • 删除蓝图Deleting the blueprint

创建和编辑蓝图Creating and editing a blueprint

创建蓝图时,请向其添加项目、将其保存到管理组或订阅,并提供唯一名称和唯一版本。When creating a blueprint, add artifacts to it, save to a management group or subscription, and provided a unique name and a unique version. 目前,蓝图处于“草稿”模式,尚不可分配。The blueprint is now in a Draft mode and can't yet be assigned. 但在“草稿”模式下,仍可继续更新和更改此蓝图。While in the Draft mode, it can continue to be updated and changed.

如果“草稿”模式下的某个蓝图从未发布过,则它在“蓝图定义”页面上显示的图标将与已发布的蓝图所显示的不同。A never published blueprint in Draft mode displays a different icon on the Blueprint Definitions page than ones that have been Published. 对于这些从未发布蓝图,最新版本显示为草稿The Latest Version is displayed as Draft for these never published blueprints.

使用 Azure 门户REST API 创建和编辑蓝图。Create and edit a blueprint with the Azure portal or REST API.

发布蓝图Publishing a blueprint

在对“草稿”模式下的蓝图进行所有计划的更改之后,此蓝图即可发布并可进行分配。Once all planned changes have been made to a blueprint in Draft mode, it can be Published and made available for assignment. 已发布的蓝图版本不可更改。The Published version of the blueprint can't be altered. 一旦发布,该蓝图显示的图标就与“草稿”蓝图的不同,并在“最新版本”列中显示所提供的版本号。Once Published, the blueprint displays with a different icon than Draft blueprints and displays the provided version number in the Latest Version column.

使用 Azure 门户REST API 发布蓝图。Publish a blueprint with the Azure portal or REST API.

创建和编辑新版本的蓝图Creating and editing a new version of the blueprint

已发布的蓝图版本不可更改。A Published version of a blueprint can't be altered. 但是,可向现有蓝图添加新版蓝图且可按需更改此新版本。However, a new version of the blueprint can be added to the existing blueprint and modified as needed. 通过编辑对现有蓝图进行更改。Make changes to an existing blueprint by editing it. 保存新更改时,蓝图将包含未发布的更改When the new changes are saved, the blueprint now has Unpublished Changes. 这些更改是蓝图的新草稿版本。These changes are a new Draft version of the blueprint.

使用 Azure 门户创建蓝图。Edit a blueprint with the Azure portal.

发布新版本的蓝图Publishing a new version of the blueprint

蓝图的每个编辑版本必须在发布之后才可分配。Each edited version of a blueprint must be Published before it can be assigned. 当对蓝图进行未发布的更改,但它们尚未发布时,“发布蓝图”按钮在“编辑蓝图”页面上可用。When Unpublished Changes have been made to a blueprint but not Published, the Publish Blueprint button is available on the edit blueprint page. 如果未显示该按钮,则表示蓝图已发布,但具有“未发布的更改”。If the button isn't visible, the blueprint has already been Published and has no Unpublished Changes.

备注

一个蓝图可具有多个已发布的版本,每个版本都可分配到订阅。A single blueprint can have multiple Published versions that can each be assigned to subscriptions.

若要发布包含未发布更改的蓝图,请使用发布新蓝图的相同步骤。To publish a blueprint with Unpublished Changes, use the same steps for publishing a new blueprint.

删除特定版本的蓝图Deleting a specific version of the blueprint

蓝图的每一个版本都是唯一对象,可单独发布。Each version of a blueprint is a unique object and can be individually Published. 因此,还可以删除蓝图的每个版本。As such, each version of a blueprint can also be deleted. 删除其中一个蓝图版本将不对该蓝图的其他版本造成任何影响。Deleting a version of a blueprint doesn't have any impact on other versions of that blueprint.

备注

不能删除具有活动分配项的蓝图。It's not possible to delete a blueprint that has active assignments. 请先删除分配项,再删除要移除的版本。Delete the assignments first and then delete the version you wish to remove.

  1. 在左侧窗格中,选择“所有服务”。Select All services in the left pane. 搜索并选择“蓝图”。Search for and select Blueprints.

  2. 从左侧页面中选择 "蓝图定义",并使用筛选器选项查找要删除其版本的蓝图。Select Blueprint definitions from the page on the left and use the filter options to locate the blueprint you want to delete a version of. 单击它以打开“编辑”页面。Click on it to open the edit page.

  3. 单击“已发布的版本”选项卡,找到要删除的版本。Click the Published versions tab and locate the version you wish to delete.

  4. 右键单击要删除的版本,然后选择 "删除此版本"。Right-click on the version to delete and select Delete this version.

删除蓝图Deleting the blueprint

此外,还可删除核心蓝图。The core blueprint can also be deleted. 删除核心蓝图也会删除该蓝图的任何蓝图版本,包括草稿已发布的蓝图。Deleting the core blueprint also deletes any blueprint versions of that blueprint, including both Draft and Published blueprints. 与删除蓝图版本一样,删除核心蓝图时不会删除任何蓝图版本的现有分配项。As with deleting a version of a blueprint, deleting the core blueprint doesn't remove the existing assignments of any of the blueprint versions.

备注

不能删除具有活动分配项的蓝图。It's not possible to delete a blueprint that has active assignments. 请先删除分配项,再删除要移除的版本。Delete the assignments first and then delete the version you wish to remove.

使用 Azure 门户REST API 删除蓝图。Delete a blueprint with the Azure portal or REST API.

分配Assignments

可在蓝图生命周期的多个时间点向订阅分配此蓝图。There's several points during the lifecycle a blueprint can be assigned to a subscription. 当蓝图版本处于“已发布”模式时,可向订阅分配此版本。When the mode of a version of the blueprint is Published, then that version can be assigned to a subscription. 在开发较新的版本期间,此生命周期使蓝图版本可供使用和主动分配。This lifecycle enables versions of a blueprint to be used and actively assigned while a newer version is being developed.

由于蓝图的版本已分配,因此有必要了解其分配位置及其分配有的具体参数。As versions of blueprints are assigned, it's important to understand where they're assigned and with what parameters they've been assigned with. 参数可以是静态的,也可以是动态的。The parameters can either be static or dynamic. 要了解详细信息,请参阅静态和动态参数To learn more, see static and dynamic parameters.

更新分配Updating assignments

分配蓝图时可以更新分配。When a blueprint is assigned, the assignment can be updated. 众多原因导致要更新现有分配,其中包括:There are several reasons for updating an existing assignment, including:

要了解操作方式,请参阅更新现有分配To learn how, see update existing assignments.

取消分配赋值Unassigning assignments

如果不再需要该蓝图,则可以将其从管理组或订阅中取消分配。If the blueprint is no longer needed, it can be unassigned from the management group or subscription. 在蓝图取消分配期间,会发生以下情况:During blueprint unassignment, the following occurs:

  • 删除蓝图资源锁定Removal of blueprint resource locking
  • 删除蓝图分配对象Deletion of the blueprint assignment object
  • 增值税如果使用系统分配的托管标识,还会将其删除(Conditional) If a system-assigned managed identity was used, it's also deleted

备注

蓝图分配部署的所有资源都将保留原样,但不再受 Azure 蓝图的保护。All resources deployed by the blueprint assignment remain in place, but are no longer protected by Azure Blueprints.

后续步骤Next steps