简体   繁体   English

AWS IAM / QuickSight-用户无权执行:quicksight:资源上的GetDashboardEmbedUrl

[英]AWS IAM / QuickSight - user is not authorized to perform: quicksight:GetDashboardEmbedUrl on resource

I am trying to use the embed QuickSight dashboard URL function in my ASP.NET MVC project. 我正在尝试在ASP.NET MVC项目中使用嵌入的QuickSight仪表板URL函数。 For testing, I'm simply trying to output the embed URL to a string. 为了进行测试,我只是尝试将嵌入的URL输出到字符串。 Here is the main part of my code: 这是我的代码的主要部分:

    var awsCredentials = new BasicAWSCredentials("redacted", "redacted");

    AmazonSecurityTokenServiceClient stsClient = new AmazonSecurityTokenServiceClient(awsCredentials);
    var tokenServiceRequest = stsClient.GetSessionToken();

    var client = new AmazonQuickSightClient(
        tokenServiceRequest.Credentials.AccessKeyId,
        tokenServiceRequest.Credentials.SecretAccessKey,
        tokenServiceRequest.Credentials.SessionToken,
        Amazon.RegionEndpoint.APSoutheast2);
    try
    {
        string machineTypeEmbedUrl =
            client.GetDashboardEmbedUrlAsync(new GetDashboardEmbedUrlRequest
            {
                AwsAccountId = "redacted",
                DashboardId = "redacted",
                IdentityType = IdentityType.IAM,
                ResetDisabled = true,
                SessionLifetimeInMinutes = 100,
                UndoRedoDisabled = false
            }).Result.EmbedUrl;
    }
    catch (Exception ex)
    {
        return new HttpStatusCodeResult(HttpStatusCode.BadRequest,ex.Message);
    }

In order to support the permissions required, I have set up an IAM user with the STS Assume Role allowed as follows: 为了支持所需的权限,我已经设置了具有STS假定角色的IAM用户,如下所示:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "Stmt1551593192075",
            "Action": [
                "sts:AssumeRole"
            ],
            "Effect": "Allow",
            "Resource": "arn:aws:iam::redacted:role/assume-quicksight-role"
        }
    ]
}

I have set up the role specified above with the following permissions, and set its trust policy so that the IAM user above can assume it. 我已经使用以下权限设置了上面指定的角色,并设置了其信任策略,以便上述IAM用户可以承担该角色。

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Action": "quicksight:RegisterUser",
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": "quicksight:GetDashboardEmbedUrl",
            "Resource": "arn:aws:quicksight:ap-southeast-2:redacted:dashboard/redacted",
            "Effect": "Allow"
        }
    ]
}

So as far as I can tell this should work. 据我所知这应该工作。 Debug reveals I do get a session token which is passed to the embedUrl request, however I get the following error: 调试显示我确实获得了会话令牌,该令牌已传递到embedUrl请求,但是出现以下错误:

InnerException = {"User: arn:aws:iam:::user/api-dev-quicksight-user is not authorized to perform: quicksight:GetDashboardEmbedUrl on resource: arn:aws:quicksight:ap-southeast-2::dashboard/"} InnerException = {“用户:arn:aws:iam :::: user / api-dev-quicksight-用户无权执行:资源上的quicksight:GetDashboardEmbedUrl:arn:aws:quicksight:ap-southeast-2 :: dashboard / “}

I'm not sure why this happens? 我不确定为什么会这样? I have a user that can assume the right role, and the role has the right permissions to the dashboard in question. 我有一个可以担当正确角色的用户,并且该角色对所涉及的仪表板具有正确的权限。 What am I missing here? 我在这里想念什么?

Try to change your role like this (notice the :: double colon before dashboard ): 尝试像这样更改您的角色(注意:: dashboard前的::双冒号):

...
"Action": "quicksight:GetDashboardEmbedUrl", 
"Resource": "arn:aws:quicksight:ap-southeast-2::dashboard/*", 
"Effect": "Allow"
...

This should allow the user to access all the sub-resources under the dashboard. 这应该允许用户访问仪表板下的所有子资源。

To follow the Least Privilege principle recommend by AWS, you should list all your resources: 要遵循AWS建议的最低特权原则 ,您应该列出所有资源:

...
"Resource": [
    "arn:aws:quicksight:ap-southeast-2::dashboard/", 
    "arn:aws:quicksight:ap-southeast-2::dashboard/redacted"]
... 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 AWS IAM / QuickSight - 用户:arn:aws:sts::xxxxxxxx:assumed-role/yyyy/nnnnnn 无权执行:quicksight:RegisterUser on resource - AWS IAM / QuickSight - User: arn:aws:sts::xxxxxxxx:assumed-role/yyyy/nnnnnn is not authorized to perform: quicksight:RegisterUser on resource AWS:AccessDeniedException:用户:{user} 无权执行:quicksight:ListDashboards on resource - AWS: AccessDeniedException: User: {user} is not authorized to perform: quicksight:ListDashboards on resource 用户无权执行:iam:PassRole on resource error in create AWS codepipeline - User not authorized to perform: iam:PassRole on resource error in creating AWS codepipeline AWS EKS:用户无权执行:对资源执行 iam:CreateRole - AWS EKS: user is not authorized to perform: iam:CreateRole on resource AWS Quicksight - 启用用户评论 - AWS Quicksight - Enabling User Comments AWS boto3 用户:arn:aws:iam::xxxx:root 无权执行:lambda:AddLayerVersionPermission 对资源 - AWS boto3 User: arn:aws:iam::xxxx:root is not authorized to perform: lambda:AddLayerVersionPermission on resource 错误代码:AccessDeniedException。 用户:arn:aws:iam::xxx:user/xxx 无权执行:lambda:CreateEventSourceMapping on resource:* - Error code: AccessDeniedException. User: arn:aws:iam::xxx:user/xxx is not authorized to perform: lambda:CreateEventSourceMapping on resource: * 用户:arn:aws:iam::AN:user/root 无权执行:dynamodb:DescribeTable 资源:arn:aws:dynamodb:eu-west-1:AN:table/MyTable - User: arn:aws:iam::AN:user/root is not authorized to perform: dynamodb:DescribeTable on resource: arn:aws:dynamodb:eu-west-1:AN:table/MyTable IAM用户无权执行:在资源xxxx上使用明确拒绝的firehose:CreateDeliveryStream - Iam user not authorized to perform: firehose:CreateDeliveryStream on resource xxxx with an explicit deny Amazon SES 异常:IAM 用户无权对资源执行“ses:SendRawEmail” - Amazon SES Exception: IAM User is not authorized to perform `ses:SendRawEmail' on resource
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM