使用混亂實驗範本在 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 中斷範本實驗,即可: