Skip to content

Commit 86c1a57

Browse files
committed
Updated script to use size as the -skuName param
1 parent 76afe67 commit 86c1a57

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

articles/lab-services/quick-create-lab-powershell.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,12 @@ We'll choose the Windows 11 image.
5353
$image = $plan | Get-AzLabServicesPlanImage | Where-Object { $_.EnabledState.ToString() -eq "enabled" -and $_.DisplayName -eq "Windows 11 Pro (Gen2)" }
5454
```
5555

56-
When you create a lab by using PowerShell, you also need to provide the resource SKU information. The following command uses the [REST API to retrieve the list of SKUs](/rest/api/labservices/skus/list):
56+
When you create a lab by using PowerShell, you also need to provide the resource SKU information. The following command uses the [REST API to retrieve the list of SKUs](/rest/api/labservices/skus/list) and selects the `Classic_Fsv2_4_8GB_128_S_SSD` SKU:
5757

5858
```powershell
5959
$subscriptionId = (Get-AzContext).Subscription.ID
60-
(Invoke-AzRestMethod -Uri https://management.azure.com/subscriptions/$subscriptionId/providers/Microsoft.LabServices/skus?api-version=2022-08-01 | Select-Object -Property "Content" -ExpandProperty Content | ConvertFrom-Json).value.name | Get-Unique
60+
$skus = (Invoke-AzRestMethod -Uri https://management.azure.com/subscriptions/$subscriptionId/providers/Microsoft.LabServices/skus?api-version=2022-08-01 | Select-Object -Property "Content" -ExpandProperty Content | ConvertFrom-Json).value
61+
$sku = $skus | Where-Object -Property "name" -eq "Classic_Fsv2_4_8GB_128_S_SSD" | select-object -First 1
6162
```
6263

6364
We're now ready to create a lab based of our lab plan with the Window 11 Pro image and the `Classic_Fsv2_4_8GB_128_S_SSD` resource SKU. The following command will create a lab using the lab plan created above.
@@ -91,7 +92,7 @@ $lab = New-AzLabServicesLab -Name "ContosoLab" `
9192
-ImageReferenceSku $image.Sku `
9293
-ImageReferenceVersion $image.Version `
9394
-SkuCapacity 1 `
94-
-SkuName "Classic_Fsv2_4_8GB_128_S_SSD" `
95+
-SkuName $sku.size `
9596
`
9697
-Title "Contoso Lab" `
9798
-Description "The Contoso lab" `

0 commit comments

Comments
 (0)