Quickstart: Create a lab plan using PowerShell and the Azure modules
In this article you, as the admin, 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.
An Azure account with an active subscription. Create an account for free.
Azure Az PowerShell module. Must be version 7.2 or higher.
Run Connect-AzAccount to sign in to Azure and verify an active subscription.
Create a lab plan
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")
Add a user to the Lab Creator role
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.
Clean up resources
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