简体   繁体   中英

How to connect to AWS Quicksight service on C#

I'm trying to embed a dashboard I created using Quicksight I have the code they publish on the site, but where do I get the data that passes to the AmazonQuickSightClient object.

Do I need to authenticate before this code?

//example from AWS site
var client = new AmazonQuickSightClient(
    AccessKey,
    SecretAccessKey,
    sessionToken,
    Amazon.RegionEndpoint.USEast1);
try
{
    Console.WriteLine(
        client.GetDashboardEmbedUrlAsync(new GetDashboardEmbedUrlRequest
        {
            AwsAccountId = 111122223333,
            DashboardId = "1c1fe111-e2d2-3b30-44ef-a0e111111cde",
            IdentityType = IdentityType.IAM,
            ResetDisabled = true,
            SessionLifetimeInMinutes = 100,
            UndoRedoDisabled = false
        }).Result.EmbedUrl
    );
} catch (Exception ex) {
    Console.WriteLine(ex.Message);
}

You need to AssumeRole in order to get the credentials that will contain the AccessKey, SecretAccessKey, and SessionToken.

See https://aws.amazon.com/blogs/big-data/embed-interactive-dashboards-in-your-application-with-amazon-quicksight/

Look into Step 3 which executes this command

aws sts assume-role --role-arn "arn:aws:iam::293424211206:role/QuickSightEmbed" --role-session-nametom.smith@example.com

For .NET you can look at this API to AssumeRole https://docs.aws.amazon.com/sdkfornet/v3/apidocs/items/SecurityToken/MSecurityTokenServiceAssumeRoleAssumeRoleRequest.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM