In addition to my comment earlier, this specific issue could happen during azure VM password reset, if the VMAgent extension is broken or not installed or Remote Desktop related services are not running..
Incase there is no issue with VMAgent Extension, and If portal continues to throw the same error, you can leverage AzureCLI to reset the password using the following cmdlets
azure login
azure config mode arm
azure vm reset-access -g <<RESORCE_GROUP_NAME>> -n <<VM_NAME>> -u <<USER>> -p <<PASSWORD>>
Reference : https://learn.microsoft.com/en-us/azure/virtual-machines/extensions/vmaccess#reset-password
An Alternative Solution:
If the Azure VM access extension doesn't respond and you're unable to reset the password, you can reset the local Windows password offline. This method is more advanced and requires you to connect the virtual hard disk of the problematic VM to another VM. Follow the steps documented in this article, and attempt the offline password reset method only if the first suggested steps don't work.
https://learn.microsoft.com/en-us/troubleshoot/azure/virtual-machines/reset-local-password-without-agent
(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)