An Azure service that provides private and fully managed Remote Desktop Protocol (RDP) and Secure Shell (SSH) access to virtual machines.
Hi Cole Duprey,
Thanks for reaching out in Microsoft Q&A forum,
The certificate mismatch in Azure Bastion RDP with AAD auth stems from the Windows VM's self-signed RDP listener certificate being generated with the private IP as its Common Name (CN) or Subject Alternative Name (SAN), rather than the hostname Bastion expects during connection. This mismatch triggers the error since Bastion passes the correct hostname, but the VM can't validate it against its cert. Your working setup in the other subscription probably has VMs where the RDP cert auto-generated properly with hostname details, likely due to consistent imaging, naming conventions, or Group Policy differences.
Steps:
- Regenerate RDP cert on the VM: Connect via Bastion browser or serial console, open PowerShell as admin, and run:
Stop-Service -Name "SessionEnv" -Force; Get-ChildItem -Path Cert:\LocalMachine\Remote Desktop | Remove-Item -Force; Start-Service -Name "SessionEnv". Restart the VM to force a new self-signed cert with proper hostname binding . - Custom cert deployment: Create one explicitly with
New-SelfSignedCertificate -DnsName "vmhostname.domain.com" -CertStoreLocation "Cert:\LocalMachine\My", note the thumbprint, then bind viawmic /namespace:\\root\Microsoft\Windows\RDInfrastructure Path Win32_TSGatewayServerRole set SSLCertificateSHA1Hash="THUMBPRINT". Restart Remote Desktop Services. - RDP file workaround: Use
az network bastion rdp --configureto download the file, editaddressorgatewayhostnameto the private IP, and connect bypasses hostname validation temporarily. - Verify VM config: Run
hostnameto confirm it matches your Bastion command; check Entra ID device join status and ensure Bastion is Standard SKU for full AAD support.
Reference:
- Troubleshoot Azure Bastion | Microsoft Learn
- An internal error occurs when you make an RDP connection to Azure Virtual Machines - Virtual Machines | Microsoft Learn
Kindly let us know if the above helps or you need further assistance on this issue.
Please do not forget to
and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.