title | titleSuffix | description | author | ms.topic | ms.date | ms.custom |
---|---|---|---|---|---|---|
Create a lab plan using PowerShell |
Azure Lab Services |
Learn how to create an Azure Lab Services lab plan using PowerShell and the Azure PowerShell module. |
RogerBestMSFT |
how-to |
06/15/2022 |
mode-api, devx-track-azurepowershell |
In this article, you learn how to use PowerShell and the Azure module to create a lab plan. Lab plans are used when creating labs for Azure Lab Services. You'll also add a role assignment so an educator can create labs based on the lab plan. For an overview of Azure Lab Services, see An introduction to Azure Lab Services.
[!INCLUDE Azure subscription] [!INCLUDE Create and manage labs]
-
Azure Az PowerShell module. Must be version 7.2 or higher.
Install-Module 'Az'
-
Az.LabServices PowerShell module.
Install-Module 'Az.LabServices'
Run Connect-AzAccount to sign in to Azure and verify an active subscription.
The following steps will show you how to create a lab plan. Any properties set in the lab plan will be used in labs created with this plan.
New-AzResourceGroup -Name "MyResourceGroup" -Location "eastus"
$plan = New-AzLabServicesLabPlan -Name "ContosoLabPlan" `
-ResourceGroupName "MyResourceGroup" `
-Location "eastus" `
-AllowedRegion @("westus","eastus")
To create or edit up a lab in the Lab Services web portal (https://labs.azure.com), the educator must be assigned the Lab Creator role. Assigning the Lab Creator role on the lab plan's resource group will allow an educator to use all lab plans in that resource group.
New-AzRoleAssignment -SignInName <emailOrUserprincipalname> `
-RoleDefinitionName "Lab Creator" `
-ResourceGroupName "MyResourceGroup"
For more information about role assignments, see Assign Azure roles using Azure PowerShell.
If you're not going to continue to use this application, delete the lab with the following steps:
Remove-AzRoleAssignment -SignInName <emailOrUserprincipalname> `
-RoleDefinitionName "Lab Creator" `
-ResourceGroupName "MyResourceGroup"
$plan | Remove-AzLabServicesLabPlan
In this article, you created a resource group and a lab plan. As an admin, you can learn more about Azure PowerShell module and Az.LabServices cmdlets.
[!div class="nextstepaction"] Create a lab using PowerShell and the Azure module