azureazure-bastion

Azure VM creation with Bastion


How to solve this issue?

The target machine has denied access to this connection. If you require access, please grant access to your account on the target machine, or check your system settings.

Issue: The target machine has denied access to this connection. If you require access, please grant access to your account on the target machine, or check your system settings.

I tried to create azure virtual machine by using bastion connection by disabling the public ports. I am getting the OS image screenshot in boot diagnostics but i am unable to connect using bastion it is showing the error in image? Thank you!


Solution

  • The target machine has denied access to this connection. If you require access, please grant access to your account on the target machine or check your system settings.
    

    This error occurs due to multiple reasons like if the user account trying to connect do not have the required permissions to access the machine.

    Make sure to assign the user Reader role on the virtual machine, the NIC with the private IP of the virtual machine. refer this MSDoc

    In my case when I added NSG inbound rule 3389 configured to allow bastion its connected:

    enter image description here

    In vm -> run command -> SetRDPPort -> Run

    enter image description here

    Now bastion connected successfully:

    enter image description here

    References:

    Quickstart: Deploy Bastion with default settings - Azure Bastion | Microsoft Learn

    https://learn.microsoft.com/en-us/azure/bastion/bastion-nsg