google-cloud-platformpasswordsgoogle-compute-enginegcloudgoogle-cloud-iam

Issue with gcloud compute reset-windows-password using service account in Google Cloud


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:

enter image description here


Solution

  • To solve the problem I proceeded to add the username in the gcloud instruction like this:

    gcloud compute reset-windows-password my-instance --zone=my-zone --project=my-project --user=my-user
    

    This creates the user myuser on the Windows server (unless it already exists) and the password is successfully reset.