Hello Alexandre Paiva
Adding to above response of Ali on how to connect from Linux and Windows Machines to an Azure VM via, I would also request you to check if port 22 is open and is accessible on the Public IP of VM.
Try to check if port 22 is open on the Public IP using this link(https://ping.eu/port-chk/). This should show open. If this results as Closed, then check the NSG impacting VM and add port 22 to open traffic on 22 port.
Ref: https://video2.skills-academy.com/en-us/azure/virtual-network/tutorial-filter-network-traffic#create-security-rules
Also, if you are trying to connect from a Windows machine using putty, you have to convert your pem file to ppk first.
Use puttygen tool to convert it https://www.puttygen.com/convert-pem-to-ppk
Once you have the ppk file to connect to VM, open putty and key in the public IP of the Azure VM in the Hostname.
Select the ppk file under the Auth tab and select Open. Once the SSH connection is established, then key in the username.
Hope this helps.
If you need further help on this, tag me in a comment.
If the suggested response helped you resolve your issue, please 'Accept as answer', so that it can help others in the community looking for help on similar topics.