This is Part 15 of azure tutorial. In this video, we'll understand, why you're not able
to connect to your virtual machine in azure using RDP that is Remote Desktop Protocol (RDP) and more
importantly how to fix it. vm-pragimtech, this is the virtual machine we created in our previous
video. At the moment, we are on the overview blade and we want to connect to this virtual
machine using RDP. So, let's click connect, and then RDP. So, here's the public IP address, that
we want to use to connect to our virtual machine. So, let's launch the RDP client. For that, in the
run window type this command - mstsc. Public ip address of our virtual machine is 52.146.2.209
and the port number that we want to use is this - 3389, and then connect. It's trying to establish
a remote connection to our virtual machine in azure. Let's see what's going to happen.
There we go, we have an error - we are not able to connect to our virtual machine
in azure and that's because this port 3389 is not opened for RDP connection. For that,
we have to add an inbound rule and we do that on the "Networking" tab.
Click this button "Add inbound port rule". Source, is the machine that we want to allow to connect
to our virtual machine in azure. The value "any" allows any machine on the internet to be able to
connect to our virtual machine. Obviously, this is least secure. We can filter incoming connections
to a virtual machine by a specific IP address or a range of IP addresses, by default tag or
application security group. To keep this example simple, let's select "any". Next, "Destination
port" - this is the port on our virtual machine that we want to open up for incoming
RDP connections. If you remember, we're using this port 3389 to connect to our virtual machine. So,
we have to open up that same port. So, let's change the port number here to 3389 and then
to keep it meaningful let's also name this rule port_3389 and then click "Add", to add the rule.
There we go, our inbound port rule added. Now, let's connect
to our virtual machine again using RDP. Enter the credentials, first username and then password.
Click "Yes" on the certificate warning. There we go, we are now connected and remotely logged into
our virtual machine in azure. At the moment this port - 3389 is exposed to the internet. This is a
security risk and it's only recommended for testing as hackers constantly scan
public cloud IP ranges for open ports. Once they find a port open,
they start attempting attacks using common passwords and known unpatched vulnerabilities.
One way to reduce this vulnerability is by using JIT VM access, that is just in time
virtual machine access. It basically locks down the inbound traffic to your virtual machine,
thereby reducing exposure to attacks. We'll discuss, how JIT VM access works and how to
enable it in our next video. That's it in this video. Thank you for listening.