In NSG port 22 is allowed?
After each troubleshooting step, try reconnecting to the VM.
Reset the SSH configuration.
Reset the credentials for the user.
Verify the network security group rules permit SSH traffic.
Ensure that a Network Security Group rule exists to permit SSH traffic (by default, TCP port 22).
You cannot use port redirection / mapping without using an Azure load balancer.
----------
Please don’t forget to Accept the answer
and up-vote
wherever the information provided helps you, this can be beneficial to other community members.