Google cloud platform 权限被拒绝-GCP云资源管理器setIamPolicy
运行部署管理器创建部署时,我从GCP收到403 PERMISSION_DENIED响应,该部署使用云资源管理器API创建服务帐户并为其设置IAM策略。以下是此策略的setIamPolicy模板:Google cloud platform 权限被拒绝-GCP云资源管理器setIamPolicy,google-cloud-platform,google-deployment-manager,Google Cloud Platform,Google Deployment Manager,运行部署管理器创建部署时,我从GCP收到403 PERMISSION_DENIED响应,该部署使用云资源管理器API创建服务帐户并为其设置IAM策略。以下是此策略的setIamPolicy模板: { 'resources': [ { 'name': context.env['name'], 'action': 'gcp-types/cloudresourcemanager-v1:cloudre
{
'resources': [
{
'name': context.env['name'],
'action': 'gcp-types/cloudresourcemanager-v1:cloudresourcemanager.projects.setIamPolicy',
'properties': {
'resource': context.properties['resource'],
'policy': {
'bindings': context.properties['bindings']
}
}
}
]
}
GCP的答复:
“{”ResourceType:“gcp types/cloudresourcemanager-v1:cloudresourcemanager.projects.setIamPolicy”,“ResourceErrorCode:“403”,“ResourceErrorMessage:{”code:403,“message:“The
调用方没有权限,“状态”:“权限被拒绝”,“状态消息”:“禁止”,“请求路径”:“httpMethod”:“发布”}”
仅供参考:机器人帐户(12345@cloudservices.gserviceaccount.com)在IAM中被授予项目所有者权限 正确的方法是:
{
# Set the IAM policy by patching the existing policy with the
# config contents.
'name': policy_add_name,
'action': 'gcp-types/cloudresourcemanager-v1:cloudresourcemanager.projects.setIamPolicy',
'properties':
{
'resource': project_id,
'policy': '$(ref.' + policy_get_name + ')',
'gcpIamPolicyPatch': {
'add': policies_to_add,
}
}
}
您从何处运行此操作的计算机/设备?项目所有者权限不一定等于部署权限。您需要将该角色添加到该帐户。