I am facing an issue while using the gcloud compute reset-windows-password command in Google Cloud. When I try to execute the following command with my main account, everything works as expected:
gcloud compute reset-windows-password my-instance --zone=my-zone --project=my-project
However, when I attempt to run the same command using a service account, I encounter the following error:
ERROR: (gcloud.compute.reset-windows-password) Did not receive password in a reasonable amount of time. Please try again.
If this persists, confirm that the clock on your local system is correct.
Current UTC time on your system: [2023-08-21 13:11:24.059083]
I've already verify both the connection and the system time and everything appears to be correct. At this point, I'm starting to suspect that the issue might be related to a lack of permissions associated with the service account. However, I'm unsure how to address this or troubleshoot further. Are there specific permissions or configurations required for a service account to successfully execute the reset-windows-password command?
Update:
Below I report the configuration of the permissions of my service account for the project:
You seem to be on the right path in resetting the password for instance2, to dig deeper you may need to check other factors like firewalls that may be blocking the communication between the Google Cloud Services and the VM. If possible you can try to do a restart and try again to check if the issue persists. I attached some helpful links for your use case.[1][2]
[1] https://cloud.google.com/compute/docs/instances/windows/generating-credentials#windows-server-2019
[2] https://cloud.google.com/compute/docs/instances/connecting-to-windows