SSH using Azure CLI - what IP address to allow?

K. Kong 131 Reputation points
2025-02-07T13:23:36.5+00:00

I have a Standard B1s VM running Linux Ubuntu. I want to connect from the Azure VM's Connect page using SSH using Azure CLI. Below is the prerequisites screen:

User's image

There is a blue info item on Port 22 access. Does that indicate something is wrong? When I Connect, it results in "Connection timed out".

My VM firewall uses an access whitelist. Do I have to allow access to the CLI machine? If so, how do I find out its IP address?

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
8,387 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. TP 104K Reputation points
    2025-02-07T14:05:34.2833333+00:00

    Hi,

    You have to allow the public IP of the machine that will connect via SSH. To find the public IP of the client machine you may browse to below link from the client PC:

    https://api.ipify.org/

    In your NSG incoming rule I recommend you only allow the public IP(s) that you need to SSH from instead of allowing any IP. If using firewall on the VM itself you need to either allow all IPs to connect via port 22 (relying on NSG only) or update it to only allow certain IPs (both public and private).

    Please click Accept Answer and upvote if the above was helpful. If something is unclear please add a comment below.

    Thanks.

    -TP


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.