Azure 實驗室服務中實驗室帳戶的 Az.LabServices PowerShell 模組

重要

Azure Lab Services 將於 2027 年 6 月 28 日淘汰。 如需詳細資訊,請參閱淘汰指南。 為了簡化遷移流程,Microsoft 發布了自動化腳本幫助你清理實驗室服務資源,這些腳本可在 Azure Lab Services 退休腳本的 GitHub 倉庫中取得。

重要

本文中的資訊適用於實驗室帳戶。 Azure 實驗室服務實驗室計畫取代實驗室帳戶。 了解如何從建立實驗計畫開始。 對於現有的實驗室帳戶客戶,建議您從實驗室帳戶移轉至實驗室計畫

注意

若要深入了解實驗室方案所提供的整合式 Az 模組體驗,請參閱快速入門:使用 PowerShell 和 Azure 模組建立實驗室計劃

Az.LabServices PowerShell 模組可簡化 Azure 實驗室服務的管理。 本課程模組提供可撰寫的函式來建立、查詢、更新和刪除資源,例如實驗室、實驗室帳戶、VM 和映像。

安裝和啟動

  1. 安裝 Azure PowerShell

  2. Az.LabServices.psm1 模組下載至您的機器。

  3. 匯入模組:

    Import-Module .\Az.LabServices.psm1
    

一些範例命令:

# To list all the labs in your subscription:
Get-AzLabAccount | Get-AzLab

# To stop all running VMs in all labs
Get-AzLabAccount | Get-AzLab | Get-AzLabVm -Status Running | Stop-AzLabVm

下一步

GitHub 上的 Az.LabServices 首頁深入了解模組。