资源策略中的AWS NotPrincipal导致AccessDeniedException

时间:2020-04-07 20:36:19

标签: amazon-web-services amazon-iam

试图限制对SecretsManager机密的访问,而我试图将此策略附加到资源上;

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Deny",
            "Action": "secretsmanager:*",
            "Resource": "arn:aws:secretsmanager:us-east-2:<account-id>:secret:1-Cc7SuZ",
            "NotPrincipal": {"AWS": [
            "arn:aws:iam::<account-id>:user/test-user2",
            "arn:aws:iam::<account-id>:user/test-admin"
        ]}
        },
    ]
}

并引发此错误;

An error occurred (AccessDeniedException) when calling the PutResourcePolicy operation: User:
arn:aws:iam::<account-id>:user/test-admin is not authorized to perform: 
secretsmanager:PutResourcePolicy on resource: arn:aws:secretsmanager:us-east-2:<account-
id>:secret:1-Cc7SuZ with an explicit deny

更多背景信息;

  • 尝试将策略附加到Principal而不是NotPrincipal上很好,所以我不知道这怎么可能是权限问题。
  • 我要解决的问题涉及以下情况:所有这些用户都已被授予此访问权限,而我只是想让几个指定的用户保留它。

顺便说一句,是否有另一种方法可以解决此问题而不必撤销先前授予的许可?

0 个答案:

没有答案