你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

使用混沌试验模板在 Azure Active Directory 实例上引发中断

可以使用混沌试验,通过在受控环境中引发一些故障,来验证应用程序是否可以应对这些故障。 在本文中,你将使用预填充的试验模板和 Azure Chaos Studio 在 Azure Active Directory 资源上引发中断。

先决条件

在网络安全组中启用 Chaos Studio

在将该资源添加到 Chaos Studio 之前,Azure Chaos Studio 无法针对资源注入错误。 若要将资源添加到 Chaos Studio,请在资源上创建 目标和功能 。 网络安全组只有一种目标类型(服务直接)和一项功能(设置规则)。 其他资源最多可以有两种目标类型。 一种目标类型用于服务直接故障。 另一个目标类型用于基于代理的故障。 其他资源可能具有许多其他功能。

  1. 打开 Azure 门户

  2. 在搜索栏中搜索 Chaos Studio

  3. 选择“目标并查找网络安全组资源。

  4. 选择网络安全组资源,然后选择“启用目标>启用服务直接目标”。

    Screenshot that shows the Targets screen in Chaos Studio, with the network security group resource selected.

  5. 选择“审阅 + 启用”。>

现已成功将网络安全组添加到 Chaos Studio。

从模板创建试验

现在,可以从预先填充的试验模板创建试验。 混沌试验定义要针对目标资源执行的操作。 操作按顺序组织并运行。 混沌试验还定义了要针对并行运行的分支执行的操作。

  1. 在 Chaos Studio 中,转到“从模板创建新>试验”。>

    Screenshot that shows the Experiments screen, with the New from template button highlighted.

  2. 选择 AAD 中断

    Screenshot that shows the experiment templates screen, with the AAD outage template button highlighted.

  3. 为符合资源命名准则的试验添加名称。 在完成时选择“下一步: 权限”。

    Screenshot that shows the experiment basics screen, with the permissions tab button highlighted.

  4. 要使混沌试验成功运行,它必须对目标资源具有足够的权限。 为试验选择系统分配的托管标识或用户分配的托管标识。 如果希望 Chaos Studio 将运行所需的权限(以自定义角色的形式)添加到试验的标识中,可以选择启用自定义角色分配。 选择“下一步: 试验设计器”。

    Screenshot that shows the experiment permissions screen, with the experiment designer tab button highlighted.

  5. NSG 安全规则(版本 1.1) 错误中,选择“ 编辑”。

    Screenshot that shows the experiment designer screen, with the edit button within the NSG fault highlighted.

  6. 查看错误参数并选择“ 下一步:目标资源”。

    Screenshot that shows the fault parameters pane, with the target resources button highlighted.

  7. 选择要在试验中使用的网络安全组资源。 选择“保存”。

    Screenshot that shows the fault targets pane, with the save button highlighted.

  8. 选择“查看 + 创建>”以保存试验。

运行试验

现在可以运行试验了。

  1. “试验 ”视图中,选择试验。 选择“开始>确定”。
  2. 当状态更改为“正在运行”时,选择“历史记录最新运行的详细信息以查看正在运行的试验的详细信息。

后续步骤

运行 AAD 中断模板试验后,即可: