How to fix "Add an inbound network security group rule with destination port 22. " error while connecting to a Virtual Machinal through SSH even though the rule already exists.

Anubhuti Gupta 5 Reputation points
2023-02-07T10:20:51.8833333+00:00

I am trying to connect to a Azure Virtual Machine via SSH. But it shows that one of the prerequisites is not fulfilled. Namely, "Add an inbound network security group rule with destination port 22.". However when I see my Inbound Port Rules, the required rule is already added. Tell me how should I fix it?

  1. Error -->
    User's image
  2. Port Rule Already exists -->
    User's image

Although, I still connected via SSH ignoring the above warning, and now the DNS name for my web application I deployed on the particular Virtual Machine, does not work.

User's image

Let me know how to resolve this?

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,127 questions
{count} vote

2 answers

Sort by: Most helpful
  1. rafalzak 3,216 Reputation points
    2023-02-07T11:04:35.1333333+00:00

    Hi @Anubhuti Gupta,

    Did you open 22 on your VM?

    Please look into detailed guide below:

    https://learn.microsoft.com/en-us/azure/virtual-machines/windows/connect-ssh?tabs=azurecli

    or if you have another service on this port please try to open 22 on Windows/Linux Firewall.


  2. Manu Philip 16,971 Reputation points MVP
    2023-02-07T11:10:26.4033333+00:00

    Following is a nice reference to help you on detailed troubleshooting of the strange issue you face. Hope, it helps

    https://learn.microsoft.com/en-us/troubleshoot/azure/virtual-machines/troubleshoot-ssh-connection


    --please don't forget to upvote and Accept as answer if the reply is helpful--

    0 comments No comments