# 将Okta 作为权限集中管理的控制中心，整合AWS IAM Identity Center 来访问AWS

## 创建Okta账号

打开[Okta注册页面](https://www.okta.com/free-trial/)，选择Try Workforce Identity Cloud，填写注册信息，注册一个账号

验证邮箱；

登录Okta账号。

## 添加AWS IAM Identity Center到Okta

1. 在新的浏览器页面, 登录 [Okta console](https://login.okta.com/).
2. 在菜单选项中，选中 **Applications.**
3. 在 **Applications** 页面，选择 **Browse App Catalogue.**
4. 检索 `AWS IAM Identity Center`.
5. 点击 **Add Integration**, 然后选择 **Done**. 这一步添加 IAM Identity Center 到 Okta.
6. 在应用菜单下，刚才创建的AWS IAM Identity Center, 选中 **Sign On** 页签。
7. 选择 **Edit**. 你开始编辑 SAML 的设置。
8. 在**Advanced sign-on settings** 下面，复制粘贴从IAM Identity Center 控制台获取到的值：
   * IAM Identity Center ACS URL
   * IAM Identity Center issuer URL
9. 选择 **Save**.

## 从Okta 上传 SAML metadata 到 IAM Identity Center

1. 还是刚才的Okta控制台页面， 选中 **Sign On** 页签。
2. 在 SAML Signing Certificates, 选择 Action, 然后选择 View IdP metadata.
3. 保存文件为 `idp-saml.xml`.
4. 在IAM Identity Center 控制台, 确保你在 Change Identity Source 页面。
5. 打开**Identity provider metadata**，在 IdP SAML metadata，选择 **Choose file**.
6. 上传 `idp-saml.xml` 文件，然后选择 **Next.**
7. 复查一遍，然后确认。

## 在Okta添加SCIM 2.0 Test App (OAuth Bearer Token)&#x20;

Enable SCIM to synchronize users and groups.

1. In the IAM Identity Center console, in the navigation pane, choose Settings.
2. Under Automatic provisioning, choose Enable.
3. Copy the SCIM endpoint and access token to a text editor. You use these values later in this pattern.

Create SCIM application to push users and groups to IAM Identity Center.

1. In the Okta console, on the Applications page, choose Browse App Catalogue.
2. Search for `SCIM 2.0 Test App (OAuth Bearer Token)`.
3. Select SCIM 2.0 Test App (OAuth Bearer Token), and then choose Add Integration.
4. On the General Settings page, do the following:
   * In Application label, enter `SCIM 2.0 Test App (OAuth Bearer Token)`.
   * Select Do not display application icon to users.
   * Select Do not display application icon in the Okta Mobile App.
   * Choose Next, and then choose Done.
5. On the Provisioning tab, choose Configure API Integration.
6. Select Enable API integration.
7. For SCIM 2.0 Base Url, enter the SCIM endpoint you copied previously.
8. For OAuth Bearer Token, enter the access token you copied previously.
9. Choose Save, and then choose Edit.
10. Choose Enable Create Users, and then choose Save.

Create a rule that pushes users and groups to IAM Identity Center.

1. In the Okta console, choose the Push Groups tab.
2. In the Push Groups menu, choose Find Groups by Rule.
3. Name the rule `AWS SSO rule`.
4. For Group name starts with, enter `awssso`. You can use any prefix.
5. Select Immediately push groups found by this rule, and then choose Create Rule.
6. In the navigation pane, choose Directory > Groups.
7. Choose Add Group.
8. On the Add Group dialog box, for Name, enter `AWS Users`, and then choose Save.
9. On the Groups page, choose the AWS Users group.
10. On the Applications tab, select Assign Applications. Select the AWS IAM Identity Center application, and then choose Assign. This is the application that users will launch in the AWS Management Console.
11. For the SCIM 2.0 Test App (OAuth Bearer Token) application, choose Assign. Choose Save and Go Back. Users don’t interact with this application, but this application makes sure that their account and groups are provisioned into IAM Identity Center.
12. Choose Done.

## 创建并关联Okta users 和 groups

Create a new group in Okta.

1. 在 Okta 控制台，选择 Directory > Groups.
2. 选择 Add Group.
3. 在 Add Group 对话框，Name 输入 `awsssoPowerUsers`, 然后选择 **Save**.
4. 在菜单栏，选择 Applications.
5. 打开 SCIM 2.0 Test App (OAuth Bearer Token) application, 然后选择 Push Groups. You should see that awsssoPowerUsers is listed and marked as Active.
6. In the IAM Identity Center console, in the navigation pane, choose Groups. You should see that awsssoPowerUsers is listed with No users.

## 验证效果

Assign a permission set in IAM Identity Center.

1. In the IAM Identity Center console, in the navigation pane, choose AWS accounts, and then select your organization.
2. Select all of the accounts in the organization. The users belonging to the operations team will have access to all accounts.
3. Choose Assign users or groups.
4. On the Assign users and groups page, choose Groups.
5. Select awsssoPowerUsers, and then choose Next.
6. On the Select permission sets page, select AWSPowerUsersAccess.
7. Choose Finish.
8. Choose Proceed to AWS accounts.

Create a user in the Okta portal.

1. In the Okta console, in the top navigation bar, choose Directory, and then choose People.

2. Choose Add Person.

3. On the Add Person page, enter the following information:
   * For User type, choose User.
   * For First name, enter the user’s first name.
   * For Last name, enter the user’s last name.
   * For User name, enter the user’s email address.
   * For Primary email, enter the user’s email address.
   * For Groups, enter awsssoPowerUsers and AWS Users.
   * For Password, choose Set by admin, and then enter a password.

4. Clear User must change password on first login, and then choose Save.

5. In the IAM Identity Center console, in the navigation pane, choose Users. You should see the user that you created in the list.

6. Choose the user name to open General information.

7. Confirm that the user appears as Created By: SCIM.

8. In the IAM Identity Center console, in the navigation pane, choose Dashboard.

9. Copy the user portal URL.

10. Open a browser window in private or incognito mode, and then paste the user portal URL into the address bar. The browser should redirect to the Okta login page.

11. Enter the following information:
    * For username, enter the user’s email address.
    * For password, enter the user password that you created previously.

12. Provide additional security questions based on your Okta configuration. When you’re logged in, you should be returned to the IAM Identity Center console.

Verify the new user has access to the AWS account.

1. In the IAM Identity Center console, choose AWS accounts.
2. Choose your organization’s management account.
3. On the AWSPowerUsersAccess line, choose Management Console.
4. Confirm that the AWS Management Console launches.

参考资料

<https://docs.aws.amazon.com/prescriptive-guidance/latest/patterns/integrate-okta-with-aws-iam-identity-center-to-manage-users-roles-and-multi-account-access.html>
