共用方式為


使用混沌實驗範本在 Azure Active Directory 執行個體上引發中斷

您可以使用混沌實驗在受控環境中引發失敗,以驗證應用程式是否能夠從失敗中復原。 在本文中,您會使用預先填入的實驗範本和 Azure Chaos Studio,在 Azure Active Directory 資源上引發中斷。

必要條件

在您的網路安全性群組上啟用 Chaos Studio

除非資源已先新增至 Azure Chaos Studio,否則 Chaos Studio 無法對該資源插入錯誤。 若要將資源新增至 Azure 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 中斷範本實驗,即可: