.NET AWS SDK Secrets Manager 未经授权

0

【以下的问题经过翻译处理】 你好,

我正在使用.NET AWSSDK构建我的应用程序,并尝试使用Secrets Manager。我已经为SDK配置了一个编程访问用户,创建了一个IAM角色,允许在“GetSecretValue”操作上访问所需的秘密,并在代码中运行它,但它会抛出未授权异常。

我已经双重检查了SDK的区域,它已正确设置为“eu-central-1”。

我使用IAM模拟器,并显示为“ allowed”。

秘密本身没有设置任何策略。

我还查看了https://docs.aws.amazon.com/secretsmanager/latest/apireference/API_GetSecretValue.html,但没有找到好的答案。 ''' Amazon.SecretsManager.AmazonSecretsManagerException: User: arn:aws:iam::<ACCT_ID>:user/<USER> is not authorized to perform: secretsmanager:GetSecretValue on resource: <SECRET_NAME> because no identity-based policy allows the secretsmanager:GetSecretValue action ''' IAM策略:

''' { "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": "secretsmanager:GetSecretValue", "Resource": "arn:aws:secretsmanager:eu-central-1:<ACCT_ID>:secret:<SECRET_NAME>" } ] } '''

非常感谢您的帮助。

谢谢, 安德烈

1 回答
0

【以下的回答经过翻译处理】 事实证明,这是一种 PEBCAK 情况。 我不知道Secret的 ARN 与其名称不同。 在 IAM 策略中修复该问题解决了该问题。

profile picture
专家
已回答 5 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则