Connect to Bastion using RDP with Windows VM
Date published:
In this tutorial, I will be showing you how to connect to the Azure Bastion service using Native RDP protocol without any need for an open port.
Azure Bastion provides secure RDP and SSH connectivity to all of your VM in your virtual network. Recently, Microsoft has made it available to access from your native client, RDP or SSH client. This post will use a mixture of azure PowerShell and CLI commands and the bastion resource deployed on the network.
First, navigate to the virtual network you have previously created for the bastion network, then click on the configuration in the setting blade.
Once clicked on the configuration, you will need to tick on the option Native Client Support (Preview) and click on Apply to save the changes. (Note you can check the type of SKU such as Standard)
Next, I will be using Azure PowerShell to gather information on the VM that I want to connect with bastion. Connect to Azure by using the AZ-ConnectAccount command. Please note if you are using two-factor authentication on the Azure portal, you will need to use the tenant parameter before it prompts for authentication.
When you connect to the subscription, you will need to select the subscription by using the Select-AZSubscription —SubscriptionID or the -Subscription name. In this example, I will be using the subscription ID parameter.
When connecting to your subscription, you will need the following information before connecting to the VM using RDP. We can do this by using the Get-AZBastion and GetVM commands.
- BastionName
- ResourceGroupName
- VMResourceId
The next step is to get the bastion name and resource group name. Run the Get-AZBastion to the information. I have highlighted the details in red.
Afterwards, to get the VMResourceId, you can use the Get-VM –ResourceGroupName -Name to retrieve the information about the VM, including the resource ID. However, you can just run the Get-VM command to get the information about the resource group and the VM.
We will be connecting to the VM through RDP at this stage. I had to do this using Windows as it did not work on a Mac machine.
az network bastion rdp –name “vnet-bastion” –resource-group –target-resource-id
Finally, authenticate with the remote VM, and it should remote you to the server.
Thanks for reading. :)
Further Reading