Post Syndicated from Loc Trinh original https://aws.amazon.com/blogs/big-data/federate-amazon-quicksight-access-with-okta/
Amazon QuickSight is a fast, cloud-powered business intelligence service that makes it easy to deliver insights to everyone in your organization. As a fully managed service, Amazon QuickSight lets you easily create and publish interactive dashboards that can then be accessed from any device and embedded into your applications, portals, and websites.
Amazon QuickSight supports identity federation through Security Assertion Markup Language 2.0 (SAML 2.0) in both Standard and Enterprise editions. With federation, you can manage users using your enterprise identity provider (IdP) and pass them to Amazon QuickSight at log-in. Such IdPs include Microsoft Active Directory Federation Services, Ping One Federation Server, and Okta.
This post provides step-by-step guidance for how to use Okta to federate access to Amazon QuickSight.
Create an Okta application
Sign in to your Okta admin dashboard. You can create a free Okta Developer Edition account.
- From the Okta admin dashboard ribbon, choose Applications.
- If you are viewing the Developer Console, switch to Classic UI, as shown in the following screenshot.
- Choose Add Application.
- Search for Amazon Web Services and choose Add.
- Rename Application label to Amazon QuickSight and choose Next.
- For Sign-On Options, choose SAML 2.0.
- For Default Relay State, type https://quicksight.aws.amazon.com.
- Right-click on Identity Provider metadata and choose Save Link As…
- Save the XML file to disk and choose Done. You need to use this file in the next steps.
Create a SAML provider in AWS
Open a new window and sign in to the AWS Management Console.
- Open the IAM console.
- In the navigation pane, choose Identity Providers, Create Provider.
- For Provider Type, choose SAML and provide a Provider Name (for example, Okta).
- For Metadata Document, upload the XML file from the previous steps.
- Choose Next Step, Create.
- Locate the IdP that you just created and make note of the Provider ARN
Create a role for federated users
This section describes the steps for creating an IAM SAML 2.0 federation role. While Okta is used for a single sign-on, there are two ways to provision users in Amazon QuickSight:
- Grant the federation role permission to create new Amazon QuickSight users when a user visits for the first time.
- Pre-provision Amazon QuickSight users using the API and add users to the appropriate groups. This is preferred for adding users to groups within Amazon QuickSight, because you can provision the user and add them to the groups at the same time.
The following steps demonstrate how to create a federation role with permission to create new Amazon QuickSight users. If you would rather pre-provision Amazon QuickSight users, instructions for using the API are at the end of this post.
- Open the IAM console.
- In the navigation pane, choose Roles, Create Role, Select type of trusted entity as SAML 2.0 federation.
- For SAML provider, select the IdP that you created in the previous steps (Okta).
- Select Allow programmatic and AWS Management Console access.
- Choose Next: Permissions, Create policy.
- In the Create policy window, navigate to the JSON tab and type the following:
The IAM policy above grants the federation role permission to self-provision an Amazon QuickSight reader with the quicksight:CreateReader action. Best practice is to grant users in your organization reader access, and then upgrade users from within the application. Instructions for upgrading users are at the end of this post.
If you would rather pre-provision Amazon QuickSight users using the API, do not include any actions in the permission policy.
- Choose Review Policy.
- For Name, enter a value (for example, QuicksightOktaFederatedPolicy) and choose Create policy.
- On the Create role page, choose Refresh and select your new policy.
- Choose Next: Tags and Next: Review.
- Provide a Role name (for example, QuicksightOktaFederatedRole) and Role description.
- Choose Create role.
Create an AWS access key for Okta
To create an access key for Okta, follow these steps.
- Open the IAM console.
- In the navigation pane, choose Users, Add user.
- For User name, enter a value (for example, OktaSSOUser).
- For Access type, choose Programmatic access.
- Choose Next: Permissions, Attach existing policies directly, and Create policy.
- On the Create policy page, navigate to the JSON tab and type the following:
- Choose Review Policy.
- For a Name, enter a value (for example, OktaListRolesPolicy) and choose Create policy.
- On the Create user page, choose Refresh and select your new policy.
- Choose Next: Tags, Next: Review, and Create user.
- To save your access key and secret key, choose Download .csv.
Configure the Okta application
Return to the window with your Okta admin dashboard.
- For Identity Provider ARN (Required only for SAML SSO), provide the ARN (for example, arn:aws:iam::<YOUR ACCOUNT ID>:saml-provider/Okta) of the IdP that you created in previous steps.
- Choose Done.
- From the Applications dashboard, choose Provisioning.
- Choose Configure API Integration.
- Select Enable API Integration.
- For Access Key and Secret Key, provide the access key and secret key that you downloaded in previous steps.
- Choose Test API Credentials, Save.
- From the SETTINGS pane, navigate to To App.
- Choose Edit.
- Enable Create Usersand choose Save.
- Choose Assignments, Assign and then select the users or groups to which to grant federated access.
- Select the Roles and SAML User Roles to grant to the users, as shown in the following screenshot.
- Choose Save and Go Back, Done.
Launch Amazon QuickSight
Log in to your Okta Applications dashboard with a user (if you are using an admin account, switch to user mode) that has been granted federated access. You should see a new application with your label (for example, Amazon QuickSight). Choose on the application icon to launch Amazon QuickSight.
You can now manage your users and groups using Okta as your IdP and federate access to Amazon QuickSight.
Pre-provisioning Amazon QuickSight users
The outlined steps demonstrate how to grant users permission to self-provision Amazon QuickSight users when they visit Amazon QuickSight for the first time. If you would rather pre-provision Amazon QuickSight users, you can use the API to create users and groups and then add users to those groups.
- To create an Amazon QuickSight user, run the following AWS CLI Link the Amazon QuickSight user to your federated Okta username by providing the user-name parameter with the format <role name>\<email> (for example, QuicksightOktaFederatedRole\[email protected])
- Optionally, create an Amazon QuickSight group.
- Add users to groups.
By using the Amazon QuickSight API, you can manage users, groups, and group membership. After they’re created, groups automatically become available for use when modifying permissions to data sets, analyses, or dashboards by typing in the group name instead of a specific user. For other supported group and user management functions, see List of Actions by Function.
You can upgrade users between reader and author or admin in the Manage users tab of the Manage QuickSight screen.
- In the Amazon QuickSight console, choose your user name in the upper-right corner and choose Manage QuickSight.
- In the navigation pane, choose Manage users.
- Locate the user to upgrade, and select the role to grant from the Role
AmazonQuickSight dashboards can be shared using the Okta application’s single sign-on URL so that users can be federated directly to specific dashboards.
To deep link to a specific Amazon QuickSight dashboard with single sign-on, first locate the Okta application’s single sign-on URL. This can be found by opening the metadata XML file that you downloaded in the Create an Okta application steps above. The URL is the value of the Location attribute in the md:SingleSignOnService element and ends with /sso/saml.
After you have the Okta application’s single sign-on URL, append ?RelayState= to the end of the URL followed by the URL to your Amazon QuickSight dashboard. For example, your deep link URL might look as follows:
By deep-linking dashboards, you can provide users with a way to use single sign-on and directly access specific dashboards.
This post provided a step-by-step guide for configuring Okta as your IdP, and using IAM roles to enable single sign-on to Amazon QuickSight. It also showed how users and groups can be managed using the Amazon QuickSight API.
Although this post demonstrated the integration of IAM and Okta, you can replicate this solution using your choice of SAML 2.0 IdPs. For other supported federation options, see Enabling Single Sign-On Access to Amazon QuickSight Using SAML 2.0.
If you have any questions or feedback, please leave a comment.
About the Authors
Loc Trinh is a solutions architect at Amazon Web Services.
Naresh Gautam is a senior solutions architect at Amazon Web Services.