One-Liner: Launch Azure VM RDP Connection from PowerShell

You want to RDP to one of your Azure VMs, but...

Are you fed up with finding the target VM in the Azure portal? Are you running out of space to pin VMs to the portal home page?

If so, here's another one-liner I use all the time. This one RDP's to one of my Azure VMs...

Get-AzureRemoteDesktopFile -Name TheBTeamDC01 -ServiceName TheBTeam -Launch

 

Here, I use the Get-AzureRemoteDesktopFile cmdlet to download and launch an .rdp configuration file for an Azure VM called 'TheBTeamDC01' in the 'TheBTeam' service.

 

If I want to save the .rdp file for later use I can do this...

Get-AzureRemoteDesktopFile -Name TheBTeamDC01 -ServiceName TheBTeam -LocalPath C:\Users\CharlesBoy\Desktop\TheBTeamDC01.rdp

 

Here, we replace the -Launch switch with the -LocalPath parameter to define where the .rdp file is saved to.

 

Useful. However, I prefer not to clutter my desktop, so I'll stick with the -Launch switch!