Hello @Ana Cortazar ,
I was getting the same failure as you and was able to resolve it by importing the module (step 2). After that no other issues or complications to build the Azure DevTest Lab and VM in the Azure CLI.
My steps outlined below:
Install-Module psazdevtestlabs -Scope CurrentUser -Force
Import-Module /home/system/.local/share/powershell/Modules/psazdevtestlabs/1.0.4/PSAzDevTestLabs.psm1
$subscriptionId = "####"
$rgName = 'test_group'
$labName = 'MyTestLab'
New-AzDevTestLab -SubscriptionId $subscriptionId -ResourceGroupName $rgName -Name $labName -VirtualNetworkName TestLabvNet
$publisher = (Get-AzVMImagePublisher -Location 'Central US').where({ $_.PublisherName -eq 'MicrosoftWindowsServer' })
$offer = (Get-AzVMImageOffer -Location 'Central US' -PublisherName $publisher.PublisherName).where({ $_.Offer -eq 'WindowsServer' })
$sku = (Get-AzVMImageSku -Location 'Central US' -PublisherName $publisher.PublisherName -Offer $offer.Offer).where({ $_.Skus -eq '2019-Datacenter-Core' })
$size = (Get-AzVMSize -Location 'Central US').where({ $_.Name -eq 'Standard_DS2_v2' })
$newVmParams = @{
Name = 'MYTESTVM'
SubscriptionId = $subscriptionId
ResourceGroupName = $rgName
LabName = $labName
AdminUserName = 'adam'
AdminPassword = 's3cret p@ssword'
VMImageOffer = $sku.Offer
VMImagePublisher = $sku.PublisherName
VMImageSku = $sku.Skus
VmSize = $size.Name
}
New-AzDevTestLabVM @newVmParams
--------------------------
Hope above answers your question and concern. Let me know if you need additional assistance. If the answer was helpful, please accept it and complete the quality survey so that others can find a solution.
Sincerely,
Olga