我想确保所有使用默认Compute Engine服务帐户运行的VM的API访问权限均已锁定,因此,为什么我有兴趣过滤gcloud命令以识别任何不符合要求的实例,但是我仍在努力找出答案正确的命令。
我知道我将需要在最终命令中包括AND以在配置为与默认Compute Engine服务帐户VM一起运行的VMS上进行过滤,但现在我想正确使用范围过滤器!
基于有关过滤MachineType here的Google文档,我认为在从REST VM详细信息中识别出为Cloud API的完全访问配置的URL为https://www.googleapis.com/auth/cloud-platform后,可以对作用域进行过滤
我尝试了这些命令,但没有给我列出配置了作用域的VM列表允许对所有Cloud API的完全访问权限]] >>gcloud compute instances list --filter='Allow full access to all Cloud APIs'
gcloud compute instances list --filter="scopes:[https://www.googleapis.com/auth/cloud-platform]"
任何人都知道命令应该是什么?
我想确保所有使用默认Compute Engine服务帐户运行的VM的API访问权限均已锁定,因此为什么我有兴趣过滤gcloud命令以识别任何...
serviceAccounts
键下列出。通常,每个实例只有一个服务帐户。您可以按照第一个服务帐户的范围列表进行过滤,例如:gcloud compute instances list --filter="serviceAccounts[0].scopes:(cloud-platform)"