As a lab owner, you can delete VMs from your lab in the Azure portal. You also can delete all the VMs in your lab by using a PowerShell script. In the following example, under the values to change comment, modify the parameter values. You can retrieve the subscriptionId, labResourceGroup, and labName values from the lab pane in the Azure portal.
Please refer to below example , additional details please reference this documentation.
# Delete all the VMs in a lab.
# Values to change:
$subscriptionId = ""
$labResourceGroup = ""
$labName = ""
# Sign in to your Azure account.
Connect-AzAccount
# Select the Azure subscription that has the lab. This step is optional
# if you have only one subscription.
Select-AzSubscription -SubscriptionId $subscriptionId
# Get the lab that has the VMs that you want to delete.
$lab = Get-AzResource -ResourceId ('subscriptions/' + $subscriptionId + '/resourceGroups/' + $labResourceGroup + '/providers/Microsoft.DevTestLab/labs/' + $labName)
# Get the VMs from that lab.
$labVMs = Get-AzResource | Where-Object {
$_.ResourceType -eq 'microsoft.devtestlab/labs/virtualmachines' -and
$_.Name -like "$($lab.Name)/*"}
# Delete the VMs.
foreach($labVM in $labVMs)
{
Remove-AzResource -ResourceId $labVM.ResourceId -Force
}