I'm not able to take RDP session for a VM created in Devtest labs through PS Script?

2020-08-14T16:32:29.747+00:00

az login
az account set --subscription "***********************************"
$VMname = Read-Host "Your Vm name"
$AccountName = Read-Host "VM account Name"
$AccountPassword = Read-host "VM account Password"
$size = "Standard_F2S_v2"
$lab = Get-AzResource -ResourceId "/subscriptions/***********************/resourceGroups/*****************/providers/microsoft.devtestlab/labs/**********************"
$image = Get-AzResource -ResourceId "/subscriptions/*****/resourceGroups/*************/providers/Microsoft.DevTestLab/labs/**********/galleryimages"
$image.Name
$imageName = Read-host "Past the image name hear"
az lab vm create --resource-group $lab.ResourceGroupName --lab-name $lab.Name --name $VMname --image $imageName --image-type gallery --size $size --admin-username '$AccountName' --admin-password '$AccountPassword'

I'm able to successfully create VM in Devtestlabs through above script but i'm not able to take RDP for the VM.

If I create the VM from Azure portal there isn't any issue with taking RDP.

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,318 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Didier3001 981 Reputation points Microsoft Employee
    2020-08-16T13:10:31.063+00:00

    Hi @Prasanth Thirumalasetty (MINDTREE LIMITED)

    Did you compare the network configuration between the two deployment methods ? You should have a VNet and a Shared public IP:
    https://learn.microsoft.com/en-us/azure/devtest-labs/devtest-lab-configure-vnet

    --I hope this helps. Please Accept it as an answer and "Up-Vote" the answer or message(s) that helped you so that it can help others in the community looking for help on similar topics

    Regards,
    Didier3001

    0 comments No comments