You can paste the following PowerShell script into a Run PowerShell script action to change the password of the user on the machine:
import-module activedirectory
Set-ADAccountPassword -Identity {Username} -OldPassword (ConvertTo-SecureString -AsPlainText "{OldPassword}" -Force) -NewPassword (ConvertTo-SecureString -AsPlainText "{NewPassword}" -Force)
You'll need to provide the following parameters (replace the placeholders in the script with actual values): {Username), {OldPassword} and {NewPassword}.
You can generate a password via the Create random text action.
You would then need to pass this new password to some password vault or something like that, so you actually have it.
What you will still need to do manually is update the connection in the cloud flow, as it will stop working after the password on the VM has changed. See this article on how to fix a connection when the credential stops working: https://learn.microsoft.com/en-us/power-automate/add-manage-connections
I would highly recommend using service accounts for unattended flows with appropriate password policies (such that do not expire). Password expiration is anyhow a bad idea, as it generally forces the user to store the password somewhere so they don't forget it. Not to mention using it for automation solutions.