You can get access in an Azure VM if you have lost your access of that VM or you just created a VM and don't have credentials to login into the VM, in all these scenarios you can follow below solution.
1- Get the SSH key which you use to login in any other server.
OR
2- Create a new SSH key from SSH key service.
3- Copy the public key of the key file and paste in the field of below screenshot
4- Go to the VM and in left sidebar you will see an option Reset Password click on it.
To understand it in more details watch the below video:
More references:
https://learn.microsoft.com/en-us/azure/virtual-machines/ssh-keys-portal
https://learn.microsoft.com/en-us/answers/questions/222603/how-to-get-a-second-copy-of-ssh-keys.html