我在 Google Cloud 中使用
gcloud compute reset-windows-password
命令时遇到问题。当我尝试使用我的主帐户执行以下命令时,一切都按预期进行:
gcloud compute reset-windows-password my-instance --zone=my-zone --project=my-project
但是,当我尝试使用服务帐户运行相同的命令时,遇到以下错误:
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]
我已经验证了连接和系统时间,一切似乎都是正确的。此时,我开始怀疑该问题可能与缺乏与服务帐户关联的权限有关。但是,我不确定如何解决此问题或进一步排除故障。服务帐户是否需要特定权限或配置才能成功执行
reset-windows-password
命令?
您需要拥有所需的角色和权限才能为 Windows Server VM 生成凭据。运行此命令的用户必须对包含 Windows 实例的 Google Compute Engine 项目具有“写入权限”。以下是使用 Windows 虚拟机的用户需要具有的 IAM 角色。
角色。您还可以通过自定义角色或其他预定义角色来获取所需的权限。 请参阅
云文档