Azure CLI in VS Code
Andrew Posted on 6:49 am

Create an RDP file for your Azure Virtual Machine in PowerShell

Ever need to quickly connect to one of your virtual machines in Azure? You can use CLI or Azure PowerShell or CloudShell and the Get-AzRemoteDesktopFile cmdlet to create an RDP file to use for your connection! This is not a commonly used method, but it can save you loads of time!

When connected to Azure portal, you can open the Cloud Shell and use CLI or Azure PowerShell:
Get-AzRemoteDesktopFile -ResourceGroupName "ResourceGroup01" -Name "VirtualMachine01" -LocalPath "G:\RDPFiles\RemoteDesktopFile01.rdp"

This will give you an RDP file that you can use to connect to your “VirtualMachine01” hosted in your listed resource group inside Azure.

My personal preference is to use VS Code to connect to Azure CLI:

If you don’t remember how to use Azure CLI with VS Code, check out this previous article on getting it all setup to work right here.

Hope you have a fantastic weekend!