共用方式為


快速入門:使用 Azure Chaos Studio 建立和執行混沌實驗

使用虛擬機器 (VM) 關機服務導向實驗來開始使用 Azure Chaos Studio,讓您的服務在真實世界的案例中更能復原該失敗。

必要條件

註冊 Chaos Studio 資源提供者

如果您第一次使用 Chaos Studio,您必須先註冊 Chaos Studio 資源提供者,才能將資源上線並建立實驗。 您必須針對使用 Chaos Studio 的每個訂用帳戶執行下列步驟:

  1. 開啟 Azure 入口網站
  2. 搜尋訂用帳戶,然後開啟訂用帳戶管理頁面。
  3. 選取您想要使用 Chaos Studio 的訂用帳戶。
  4. 在左側窗格中,選取 [資源提供者]
  5. 在出現的資源提供者清單中,搜尋 Microsoft.Chaos
  6. 選取 Microsoft.Chaos 提供者,然後選取 [註冊] 按鈕。

建立 Chaos Studio 支援的 Azure 資源

建立 Azure 資源,並確定它是其中一個支援的錯誤提供者。 此外,請驗證此資源是否正在可使用 Chaos Studio 的區域中建立。 在此實驗中,我們選擇 Azure VM,這是 Chaos Studio 支援的錯誤提供者之一。

在您所建立的 VM 上啟用 Chaos Studio

  1. 開啟 Azure 入口網站

  2. 在搜尋列中搜尋 Chaos Studio

  3. 選取 [目標],然後移至您建立的 VM。

  4. 選取您的 VM 旁邊的核取方塊。 從下拉式功能表中選取 [啟用目標]>[啟用服務直接目標]

    Screenshot that shows the Targets view in the Azure portal.

  5. 確認已列出所需的資源。 選取 [檢閱 + 啟用],然後 [啟用]

  6. 隨即出現通知,並指出已成功啟用所選的資源。

    Screenshot that shows a notification that indicates that targets were successfully enabled.

建立實驗

  1. 選取 [實驗]

    Screenshot that shows selecting Experiments.

  2. 選取 [建立]>[新增實驗]

  3. 填寫您要部署混沌實驗的 [訂用帳戶]、[資源群組] 和 [位置] 方塊。 指定實驗的名稱。 選取 [下一步:實驗設計工具]

    Screenshot that shows adding experiment basics.

  4. 在 Chaos Studio 實驗設計工具中,為您的 [步驟] 和 [分支] 提供易記的名稱。 選取 [新增動作] > [新增錯誤]

    Screenshot that shows the Experiment designer.

  5. 從下拉式清單中選取 [VM 關機]。 然後在 [持續時間] 方塊中填入您希望失敗持續的分鐘數。

    Screenshot that shows Fault properties.

  6. 選取 [下一步: 目標資源]

    Screenshot that shows adding a target.

  7. 選取 [新增]。

    Screenshot that shows the Add button.

  8. 驗證您的實驗看起來是否正確,然後選取 [檢閱 + 建立]>[建立]

    Screenshot that shows creating the experiment.

將實驗權限授與您的 VM

  1. 移至您的 VM,然後選取 [存取控制 (IAM)]

    Screenshot that shows Access control (IAM) in the left pane.

  2. 選取 [新增]。

    Screenshot that shows Add.

  3. 選取 [新增角色指派]

    Screenshot that shows the Add role assignment button.

  4. 搜尋 [虛擬機器參與者] 並選取角色。 選取 [下一步]。

    Screenshot that shows choosing the role for the VM.

  5. 選取 [受控識別] 選項

  6. 選擇 [選取成員],然後搜尋您的實驗名稱。 選取您的實驗,然後選擇 [選取]

    Screenshot that shows selecting the experiment.

  7. 選取檢閱+指派

執行混沌實驗

  1. 開啟 Azure 入口網站:

    • 如果您使用 @microsoft.com 帳戶,請前往這個網站
    • 如果您使用外部帳戶,請前往這個網站
  2. 選取實驗名稱旁的核取方塊,然後選取 [開始實驗]

    Screenshot that shows the Start experiment button.

  3. 選取 [是] 以確認您要開始混沌實驗。

    Screenshot that shows confirming you want to start an experiment.

  4. (選用) 選取實驗名稱,以查看實驗執行狀態的詳細檢視。

清除資源

  1. 選取實驗名稱旁的核取方塊,然後選取 [刪除]

    Screenshot that shows selecting the experiment to delete.

  2. 選取 [是] 以確認要刪除實驗。

  3. 搜尋您在 Azure 入口網站搜尋列上建立的 VM。

    Screenshot that shows selecting the VM.

  4. 選取 [刪除] 以避免對資源收費。

    Screenshot that shows deleting the VM.

下一步

現在您已執行 VM 關機服務導向實驗,您可以開始: