

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 信任的身分傳播使用案例
<a name="trustedidentitypropagation-integrations"></a>

身為 IAM Identity Center 管理員，您可能需要協助設定使用者面向應用程式的受信任身分傳播 AWS 服務。若要支援此請求，您需要以下資訊：
+ 您的使用者將與哪些面向用戶端的應用程式互動？
+ 哪些 AWS 服務 用於查詢資料和授權存取資料？
+ 何者 AWS 服務 授權存取資料？

在啟用**不涉及第三方應用程式或自訂開發應用程式之受信任身分傳播使用案例**時，您的角色是：

1. [啟用 IAM Identity Center](enable-identity-center.md)。

1. [將您現有的身分來源連接到 IAM Identity Center](tutorials.md)。

這些使用案例的受信任身分組態其餘步驟會在連線的 AWS 服務 和 應用程式中執行。連線 AWS 服務 或應用程式的管理員應參閱各自的使用者指南，以取得完整的服務特定指引。

您在啟用**涉及第三方應用程式或自訂開發應用程式之受信任身分傳播使用案例**時所扮演的角色包括 的步驟[啟用 IAM Identity Center](enable-identity-center.md)，以及[連接身分來源](tutorials.md)，以及：

1. 設定您的身分提供者 (IdP) 與第三方或自訂開發應用程式的連線。

1. 讓 IAM Identity Center 識別第三方或自訂開發的應用程式。

1. 在 IAM Identity Center 中將您的 IdP 設定為信任的字符發行者。如需詳細資訊，請參閱[使用具有受信任權杖發行者的應用程式](using-apps-with-trusted-token-issuer.md)。

連線應用程式的管理員和 AWS 服務 應參考各自的使用者指南，以取得完整的服務特定指引。

## 分析、資料湖和機器學習使用案例
<a name="tip-data-analytic-usecases-overview"></a>

您可以使用下列分析和機器學習服務來啟用受信任的傳播使用案例：
+ **Amazon Redshift** - 如需指引，請參閱 [使用 Amazon Redshift 進行信任的身分傳播](tip-usecase-redshift.md)。
+ **Amazon EMR** - 如需指引，請參閱 [使用 Amazon EMR 進行信任的身分傳播](tip-usecase-emr.md)。
+ **Amazon Athena** - 如需指引，請參閱 [使用 Amazon Athena 的受信任身分傳播](tip-usecase-ate.md)。
+ **SageMaker Studio** - 如需指引，請參閱 [使用 Amazon SageMaker Studio 進行信任的身分傳播](trusted-identity-propagation-usecase-sagemaker-studio.md)。

## 其他使用案例
<a name="tip-additional-usecases"></a>

您可以使用這些額外的 啟用 IAM Identity Center 和信任的身分傳播 AWS 服務：
+ **Amazon Q Business** - 如需指引，請參閱：
  + [使用 IAM Identity Center 的應用程式管理工作流程](https://docs.aws.amazon.com//amazonq/latest/qbusiness-ug/how-it-works.html#admin-flow-idc)。
  + [使用 IAM Identity Center 設定 Amazon Q Business 應用程式](https://docs.aws.amazon.com//amazonq/latest/qbusiness-ug/create-application.html)。
  + [使用 IAM Identity Center 受信任身分傳播設定 Amazon Q Business](https://aws.amazon.com/blogs//machine-learning/configuring-amazon-q-business-with-aws-iam-identity-center-trusted-identity-propagation/)。
+ **Amazon OpenSearch Service** - 如需指引，請參閱：
  + [Amazon OpenSearch Service 的 IAM Identity Center Trusted Identity Propagation Support](https://docs.aws.amazon.com//opensearch-service/latest/developerguide/idc-aos.html)。
  + [使用 Amazon OpenSearch Service 的集中式 OpenSearch 使用者介面 （儀表板）](https://docs.aws.amazon.com//opensearch-service/latest/developerguide/application.html)。
+ **AWS Transfer Family** - 如需指引，請參閱：
  + [Transfer Family Web 應用程式](https://docs.aws.amazon.com//transfer/latest/userguide/web-app.html)。

**Topics**
+ [分析、資料湖和機器學習使用案例](#tip-data-analytic-usecases-overview)
+ [其他使用案例](#tip-additional-usecases)
+ [使用 Amazon Redshift 進行信任的身分傳播](tip-usecase-redshift.md)
+ [使用 Amazon EMR 進行信任的身分傳播](tip-usecase-emr.md)
+ [使用 Amazon Athena 的受信任身分傳播](tip-usecase-ate.md)
+ [使用 Amazon SageMaker Studio 進行信任的身分傳播](trusted-identity-propagation-usecase-sagemaker-studio.md)

# 使用 Amazon Redshift 進行信任的身分傳播
<a name="tip-usecase-redshift"></a>

啟用受信任身分傳播的步驟取決於您的使用者是否與 AWS 受管應用程式或客戶受管應用程式互動。下圖顯示用戶端應用程式可信任的身分傳播組態 - AWS 受管或外部 AWS - 使用 Amazon Redshift 或授權服務，例如 AWS Lake Formation 或 Amazon S3 提供的存取控制來查詢 Amazon Redshift 資料Access Grants。

![\[使用 Amazon Redshift、Quick、Lake Formation 和 IAM Identity Center 的受信任身分傳播圖表\]](http://docs.aws.amazon.com/zh_tw/singlesignon/latest/userguide/images/rs-tip-diagram.png)


啟用可信任身分傳播至 Amazon Redshift 時，Redshift 管理員可以設定 Redshift 以[自動建立](https://docs.aws.amazon.com//redshift/latest/mgmt/redshift-iam-access-control-sso-autocreate.html) IAM Identity Center 的角色做為身分提供者、將 Redshift 角色映射至 IAM Identity Center 中的群組，並使用 [Redshift 角色型存取控制來授予存取權](https://docs.aws.amazon.com//redshift/latest/dg/r_tutorial-RBAC.html)。

## 支援面向用戶端的應用程式
<a name="redshift-mgn-apps-and-customer-apps"></a>

**AWS 受管應用程式**  
下列 AWS 受管用戶端應用程式支援受信任的身分傳播至 Amazon Redshift：
+ [Amazon Redshift Query Editor V2](setting-up-tip-redshift.md)
+ [快速](https://docs.aws.amazon.com//quicksight/latest/user/redshift-trusted-identity-propagation.html)

**注意**  
如果您使用 Amazon Redshift Spectrum 存取 中的外部資料庫或資料表 AWS Glue Data Catalog，請考慮設定 [Lake Formation](tip-tutorial-lf.md) 和 [Amazon S3 Access Grants](tip-tutorial-s3.md) 以提供精細存取控制。

**客戶受管應用程式**  
下列客戶受管應用程式支援 Amazon Redshift 的受信任身分傳播：
+ **Tableau** 包括 Tableau Desktop、 Tableau Server和 Tableau Prep
  + 若要為 的使用者啟用信任的身分傳播Tableau，請參閱 *AWS 大數據部落格*中的[使用 IAM Identity Center 整合 Tableau和 Okta Amazon Redshift](https://aws.amazon.com/blogs//big-data/integrate-tableau-and-okta-with-amazon-redshift-using-aws-iam-identity-center/)。
+ **SQL 用戶端** (DBeaver 和 DBVisualizer)
  + 若要為 SQL 用戶端 (DBeaver 和 DBVisualizer) 的使用者啟用信任的身分傳播，請參閱*AWS 大數據部落格*中的[使用 IAM Identity Center 將身分提供者 (IdP) 與 Amazon Redshift 查詢編輯器 V2 和 SQL 用戶端整合，以實現無縫的單一登入](https://aws.amazon.com/blogs//big-data/integrate-identity-provider-idp-with-amazon-redshift-query-editor-v2-and-sql-client-using-aws-iam-identity-center-for-seamless-single-sign-on/)。

# 使用 Amazon Redshift 查詢編輯器 V2 設定受信任的身分傳播
<a name="setting-up-tip-redshift"></a>

下列程序會逐步解說如何實現從 Amazon Redshift 查詢編輯器 V2 到 Amazon Redshift 的受信任身分傳播。

## 先決條件
<a name="setting-up-tip-redshift-prereqs"></a>

您必須先設定下列項目，才能開始使用本教學課程：

1. [啟用 IAM Identity Center](enable-identity-center.md)。建議使用[組織執行個體](organization-instances-identity-center.md)。如需詳細資訊，請參閱[先決條件和考量事項](trustedidentitypropagation-overall-prerequisites.md)。

1. [將使用者和群組從您的身分來源佈建至 IAM Identity Center](tutorials.md)。

啟用受信任身分傳播包括 IAM Identity Center 主控台中 IAM Identity Center 管理員執行的任務，以及 Amazon Redshift 主控台中 Amazon Redshift 管理員執行的任務。

## IAM Identity Center 管理員執行的任務
<a name="setting-up-tip-redshift-ssoadmin-tasks"></a>

IAM Identity Center 管理員需要完成下列任務：

1. 在具有下列許可政策的 Amazon Redshift 叢集或無伺服器執行個體存在的帳戶中**建立 [IAM 角色](https://docs.aws.amazon.com//IAM/latest/UserGuide/id_roles.html)**。如需詳細資訊，請參閱[建立 IAM 角色](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create.html)。

   1. 下列政策範例包含完成本教學課程所需的許可。若要使用此政策，請將範例政策中的*斜體預留位置文字*取代為您自己的資訊。如需其他指示，請參閱[建立政策](https://docs.aws.amazon.com//IAM/latest/UserGuide/access_policies_create.html)或[編輯政策](https://docs.aws.amazon.com//IAM/latest/UserGuide/access_policies_manage-edit.html)。

     **許可政策：**

------
#### [ JSON ]

****  

     ```
     {
         "Version":"2012-10-17",		 	 	 
         "Statement": [
             {
                 "Sid": "AllowRedshiftApplication",
                 "Effect": "Allow",
                 "Action": [
                     "redshift:DescribeQev2IdcApplications",
                     "redshift-serverless:ListNamespaces",
                     "redshift-serverless:ListWorkgroups",
                     "redshift-serverless:GetWorkgroup"
                 ],
                 "Resource": "*"
             },
             {
                 "Sid": "AllowIDCPermissions",
                 "Effect": "Allow",
                 "Action": [
                     "sso:DescribeApplication",
                     "sso:DescribeInstance"
                 ],
                 "Resource": [
                     "arn:aws:sso:::instance/Your-IAM-Identity-Center-Instance ID",
                     "arn:aws:sso::111122223333:application/Your-IAM-Identity-Center-Instance-ID/*"
                 ]
             }
         ]
     }
     ```

------

     **信任政策：**

------
#### [ JSON ]

****  

     ```
     {
         "Version":"2012-10-17",		 	 	 
         "Statement": [
             {
                 "Effect": "Allow",
                 "Principal": {
                     "Service": [
                         "redshift-serverless.amazonaws.com",
                         "redshift.amazonaws.com"
                     ]
                 },
                 "Action": [
                     "sts:AssumeRole",
                     "sts:SetContext"
                 ]
             }
         ]
     }
     ```

------

1. 在 AWS Organizations 啟用 IAM Identity Center 的管理帳戶中**建立許可集**。您將在下一個步驟中使用它，以允許聯合身分使用者存取 Redshift 查詢編輯器 V2。

   1. 前往 **IAM Identity Center** 主控台，在**多帳戶許可**下，選擇**許可集**。

   1. 選擇 **Create permission set (建立許可集合)**。

   1. 選擇**自訂許可集**，然後選擇**下一步**。

   1. 在**AWS 受管政策**下，選擇 **`AmazonRedshiftQueryEditorV2ReadSharing`**。

   1. 在**內嵌政策**下，新增下列政策：

------
#### [ JSON ]

****  

      ```
      {
          "Version":"2012-10-17",		 	 	 
          "Statement": [
              {
                  "Sid": "Statement1",
                  "Effect": "Allow",
                  "Action": [
                      "redshift:DescribeQev2IdcApplications",
                      "redshift-serverless:ListNamespaces",
                      "redshift-serverless:ListWorkgroups",
                      "redshift-serverless:GetWorkgroup"
                  ],
                  "Resource": "*"
              }
          ]
      }
      ```

------

   1. 選取**下一步**，然後提供許可集名稱的名稱。例如 **Redshift-Query-Editor-V2**。

   1. 在**轉送狀態 - 選用**下，使用格式將預設轉送狀態設定為查詢編輯器 V2 URL：`https://your-region.console.aws.amazon.com/sqlworkbench/home`。

   1. 檢閱設定，然後選擇**建立**。

   1. 導覽至 IAM Identity Center Dashboard，然後從**設定摘要**區段複製 AWS 存取入口網站 URL。  
![\[步驟 i，從 IAM Identity Center 主控台複製 AWS 存取入口網站 URL。\]](http://docs.aws.amazon.com/zh_tw/singlesignon/latest/userguide/images/setting-up-redshift-step-i.png)

   1. 開啟新的 Incognito 瀏覽器視窗並貼上 URL。

      這將帶您前往 AWS 存取入口網站，確保您使用 IAM Identity Center 使用者登入。  
![\[步驟 j：登入以 AWS 存取入口網站。\]](http://docs.aws.amazon.com/zh_tw/singlesignon/latest/userguide/images/setting-up-redshift-step-j.png)

      如需許可集的詳細資訊，請參閱 [AWS 帳戶 使用許可集管理](permissionsetsconcept.md)。

1. **啟用聯合身分使用者存取 Redshift 查詢編輯器 V2**。

   1. 在 AWS Organizations 管理帳戶中，開啟 **IAM Identity Center** 主控台。

   1. 在導覽窗格中的**多帳戶許可**下，選擇 **AWS 帳戶**。

   1. 在頁面上 AWS 帳戶 ，選取要為其指派存取權的 AWS 帳戶 。

   1. 選擇**指派使用者或群組**。

   1. 在**指派使用者和群組**頁面上，選擇要為其建立許可集的使用者和或群組。然後選擇**下一步**。

   1. 在**指派許可集**頁面上，選擇您在上一個步驟中建立的許可集。然後選擇**下一步**。

   1. 在**檢閱和提交指派**頁面上，檢閱您的選擇，然後選擇**提交**。

## Amazon Redshift 管理員執行的任務
<a name="setting-up-tip-redshift-admin-tasks"></a>

啟用 Amazon Redshift 的受信任身分傳播需要 Amazon Redshift 叢集管理員或 Amazon Redshift Serverless 管理員在 Amazon Redshift 主控台中執行許多任務。如需詳細資訊，請參閱*AWS 大數據部落格*中的[整合身分提供者 (IdP) 與使用 IAM Identity Center 的 Amazon Redshift 查詢編輯器 V2 和 SQL 用戶端，以實現無縫的單一登入](https://aws.amazon.com/blogs//big-data/integrate-identity-provider-idp-with-amazon-redshift-query-editor-v2-and-sql-client-using-aws-iam-identity-center-for-seamless-single-sign-on/)。

# 使用 Amazon EMR 進行信任的身分傳播
<a name="tip-usecase-emr"></a>

下圖顯示使用 Amazon EMR on Amazon EC2 搭配 AWS Lake Formation 和 Amazon S3 提供之存取控制的 Amazon EMR Studio 的受信任身分傳播組態Access Grants。

![\[使用 Amazon EMR、Lake Formation 和 IAM Identity Center 的受信任身分傳播圖表\]](http://docs.aws.amazon.com/zh_tw/singlesignon/latest/userguide/images/emr-tip-diagram.png)


**支援面向用戶端的應用程式**
+ Amazon EMR Studio

**若要啟用信任的身分傳播，請遵循下列步驟：**
+ [將 Amazon EMR 設定為 Studio](setting-up-tip-emr.md) Amazon EMR 叢集的面向用戶端應用程式。
+ [使用 在 Amazon EC2 上設定 Amazon EMR 叢集Apache Spark](https://docs.aws.amazon.com//emr/latest/ManagementGuide/emr-idc-start.html)。
+ *建議*： [AWS Lake Formation](tip-tutorial-lf.md)和 [Amazon S3 Access Grants](tip-tutorial-s3.md) 為 S3 中的 AWS Glue Data Catalog 和基礎資料位置提供精細的存取控制。

# 使用 Amazon EMR Studio 設定受信任的身分傳播
<a name="setting-up-tip-emr"></a>

下列程序會逐步引導您在對執行 的 Amazon Athena 工作群組或 Amazon EMR 叢集的查詢中設定 Amazon EMR Studio以進行受信任身分傳播Apache Spark。

## 先決條件
<a name="setting-up-tip-emr-prereqs"></a>

您必須先設定下列項目，才能開始使用本教學課程：

1. [啟用 IAM Identity Center](enable-identity-center.md)。建議使用[組織執行個體](organization-instances-identity-center.md)。如需詳細資訊，請參閱[先決條件和考量事項](trustedidentitypropagation-overall-prerequisites.md)。

1. [將使用者和群組從您的身分來源佈建至 IAM Identity Center](tutorials.md)。

若要從 Amazon EMR Studio 完成設定信任的身分傳播，EMR Studio 管理員必須執行下列步驟。

## 步驟 1. 建立 EMR Studio 所需的 IAM 角色
<a name="setting-up-tip-emr-step1"></a>

在此步驟中，Amazon EMR Studio管理員會建立 和 IAM 服務角色，以及 EMR 的 IAM 使用者角色Studio。

1. **[建立 EMR Studio 服務角色](https://docs.aws.amazon.com//emr/latest/ManagementGuide/emr-studio-service-role.html)** - EMR Studio 擔任此 IAM 角色，以安全地管理工作區和筆記本、連線至叢集，以及處理資料互動。

   1. 導覽至 IAM 主控台 ([https://console.aws.amazon.com/iam/](https://console.aws.amazon.com/iam/)：//) 並建立 IAM 角色。

   1. 選取 **AWS 服務**做為信任的實體，然後選擇 **Amazon EMR**。連接下列政策以定義角色的許可和信任關係。

      若要使用這些政策，請以您自己的資訊取代範例政策中的*斜體預留位置文字*。如需其他指示，請參閱[建立政策](https://docs.aws.amazon.com//IAM/latest/UserGuide/access_policies_create.html)或[編輯政策](https://docs.aws.amazon.com//IAM/latest/UserGuide/access_policies_manage-edit.html)。

------
#### [ JSON ]

****  

      ```
      {
          "Version":"2012-10-17",		 	 	 
          "Statement": [
              {
                  "Sid": "ObjectActions",
                  "Effect": "Allow",
                  "Action": [
                      "s3:PutObject",
                      "s3:GetObject",
                      "s3:DeleteObject"
                  ],
                  "Resource": [
                      "arn:aws:s3:::Your-S3-Bucket-For-EMR-Studio/*"
                  ],
                  "Condition": {
                      "StringEquals": {
                          "aws:ResourceAccount": "Your-AWS-Account-ID"
                      }
                  }
              },
              {
                  "Sid": "BucketActions",
                  "Effect": "Allow",
                  "Action": [
                      "s3:ListBucket",
                      "s3:GetEncryptionConfiguration"
                  ],
                  "Resource": [
                      "arn:aws:s3:::Your-S3-Bucket-For-EMR-Studio"
                  ],
                  "Condition": {
                      "StringEquals": {
                          "aws:ResourceAccount": "Your-AWS-Account-ID"
                      }
                  }
              }
          ]
      }
      ```

------

      如需所有服務角色許可的參考，請參閱 [EMR Studio 服務角色許可](https://docs.aws.amazon.com/emr/latest/ManagementGuide/emr-studio-service-role.html#emr-studio-service-role-permissions-table)。

1. **[為 IAM Identity Center 身分驗證建立 EMR Studio 使用者角色](https://docs.aws.amazon.com//emr/latest/ManagementGuide/emr-studio-user-permissions.html#emr-studio-create-user-role)** - 當使用者透過 IAM Identity Center 登入以管理工作區、EMR 叢集、任務、git 儲存庫時，EMR Studio 會擔任此角色。**此角色用於啟動信任的身分傳播工作流程**。
**注意**  
EMR Studio 使用者角色不需要包含存取 AWS Glue Catalog. AWS Lake Formation permissions 中資料表 Amazon S3 位置的許可。註冊的湖位置將用於接收臨時許可。

   下列範例政策可用於允許 EMR Studio 使用者使用 Athena 工作群組執行查詢的角色。

------
#### [ JSON ]

****  

   ```
   {
       "Version":"2012-10-17",		 	 	 
       "Statement": [
           {
               "Sid": "AllowDefaultEC2SecurityGroupsCreationInVPCWithEMRTags",
               "Effect": "Allow",
               "Action": [
                   "ec2:CreateSecurityGroup"
               ],
               "Resource": [
                   "arn:aws:ec2:*:*:vpc/*"
               ],
               "Condition": {
                   "StringEquals": {
                       "aws:ResourceTag/for-use-with-amazon-emr-managed-policies": "true"
                   }
               }
           },
           {
               "Sid": "AllowAddingEMRTagsDuringDefaultSecurityGroupCreation",
               "Effect": "Allow",
               "Action": [
                   "ec2:CreateTags"
               ],
               "Resource": "arn:aws:ec2:*:*:security-group/*",
               "Condition": {
                   "StringEquals": {
                       "aws:RequestTag/for-use-with-amazon-emr-managed-policies": "true",
                       "ec2:CreateAction": "CreateSecurityGroup"
                   }
               }
           },
           {
               "Sid": "AllowSecretManagerListSecrets",
               "Action": [
                   "secretsmanager:ListSecrets"
               ],
               "Resource": "*",
               "Effect": "Allow"
           },
           {
               "Sid": "AllowSecretCreationWithEMRTagsAndEMRStudioPrefix",
               "Effect": "Allow",
               "Action": "secretsmanager:CreateSecret",
               "Resource": "arn:aws:secretsmanager:*:*:secret:emr-studio-*",
               "Condition": {
                   "StringEquals": {
                       "aws:RequestTag/for-use-with-amazon-emr-managed-policies": "true"
                   }
               }
           },
           {
               "Sid": "AllowAddingTagsOnSecretsWithEMRStudioPrefix",
               "Effect": "Allow",
               "Action": "secretsmanager:TagResource",
               "Resource": "arn:aws:secretsmanager:*:*:secret:emr-studio-*"
           },
           {
               "Sid": "AllowPassingServiceRoleForWorkspaceCreation",
               "Action": "iam:PassRole",
               "Resource": [
                   "arn:aws:iam::111122223333:role/service-role/AmazonEMRStudio_ServiceRole_Name"
               ],
               "Effect": "Allow"
           },
           {
               "Sid": "AllowS3ListAndLocationPermissions",
               "Action": [
                   "s3:ListAllMyBuckets",
                   "s3:ListBucket",
                   "s3:GetBucketLocation"
               ],
               "Resource": "arn:aws:s3:::*",
               "Effect": "Allow"
           },
           {
               "Sid": "AllowS3ReadOnlyAccessToLogs",
               "Action": [
                   "s3:GetObject"
               ],
               "Resource": [
                   "arn:aws:s3:::aws-logs-Your-AWS-Account-ID-Region/elasticmapreduce/*"
               ],
               "Effect": "Allow"
           },
           {
               "Sid": "AllowAthenaQueryExecutions",
               "Effect": "Allow",
               "Action": [
                   "athena:StartQueryExecution",
                   "athena:GetQueryExecution",
                   "athena:GetQueryResults",
                   "athena:StopQueryExecution",
                   "athena:ListQueryExecutions",
                   "athena:GetQueryResultsStream",
                   "athena:ListWorkGroups",
                   "athena:GetWorkGroup",
                   "athena:CreatePreparedStatement",
                   "athena:GetPreparedStatement",
                   "athena:DeletePreparedStatement"
               ],
               "Resource": "*"
           },
           {
               "Sid": "AllowGlueSchemaManipulations",
               "Effect": "Allow",
               "Action": [
                   "glue:GetDatabase",
                   "glue:GetDatabases",
                   "glue:GetTable",
                   "glue:GetTables",
                   "glue:GetPartition",
                   "glue:GetPartitions"
               ],
               "Resource": "*"
           },
           {
               "Sid": "AllowQueryEditorToAccessWorkGroup",
               "Effect": "Allow",
               "Action": "athena:GetWorkGroup",
               "Resource": "arn:aws:athena:*:111122223333:workgroup*"
           },
           {
               "Sid": "AllowConfigurationForWorkspaceCollaboration",
               "Action": [
                   "elasticmapreduce:UpdateEditor",
                   "elasticmapreduce:PutWorkspaceAccess",
                   "elasticmapreduce:DeleteWorkspaceAccess",
                   "elasticmapreduce:ListWorkspaceAccessIdentities"
               ],
               "Resource": "*",
               "Effect": "Allow",
               "Condition": {
                   "StringEquals": {
                       "elasticmapreduce:ResourceTag/creatorUserId": "${aws:userId}"
                   }
               }
           },
           {
               "Sid": "DescribeNetwork",
               "Effect": "Allow",
               "Action": [
                   "ec2:DescribeVpcs",
                   "ec2:DescribeSubnets",
                   "ec2:DescribeSecurityGroups"
               ],
               "Resource": "*"
           },
           {
               "Sid": "ListIAMRoles",
               "Effect": "Allow",
               "Action": [
                   "iam:ListRoles"
               ],
               "Resource": "*"
           },
           {
               "Sid": "AssumeRole",
               "Effect": "Allow",
               "Action": [
                   "sts:AssumeRole"
               ],
               "Resource": "*"
           }
       ]
   }
   ```

------

   下列信任政策允許 EMR Studio 擔任該角色：
**注意**  
需要額外許可，才能利用 EMR Studio Workspaces 和 EMR Notebooks。如需詳細資訊，請參閱[建立 EMR Studio 使用者的許可政策](https://docs.aws.amazon.com//emr/latest/ManagementGuide/emr-studio-user-permissions.html#emr-studio-permissions-policies)。

**您可以透過以下連結找到更多資訊：**
   + [使用客戶管理政策定義自訂 IAM 許可](https://docs.aws.amazon.com//IAM/latest/UserGuide/access_policies_create.html)
   + [EMR Studio 服務角色許可](https://docs.aws.amazon.com//emr/latest/ManagementGuide/emr-studio-service-role.html#emr-studio-service-role-permissions-table)

## 步驟 2. 建立和設定 EMR Studio
<a name="setting-up-tip-emr-step2"></a>

在此步驟中，您將在 EMR Studio 主控台中建立 Amazon EMR Studio，並使用您在 中建立的 IAM 角色[步驟 1. 建立 EMR Studio 所需的 IAM 角色步驟 2. 建立和設定 EMR Studio](#setting-up-tip-emr-step1)。

1. 導覽至 EMR Studio 主控台，選取**建立 Studio** 和**自訂設定**選項。您可以建立新的 S3 儲存貯體或使用現有的儲存貯體。您可以勾選方塊，**使用您自己的 KMS 金鑰加密工作區檔案**。如需詳細資訊，請參閱[AWS Key Management Service](https://docs.aws.amazon.com//kms/latest/developerguide/overview.html)。  
![\[步驟 1 在 EMR 主控台中建立 EMR Studio。\]](http://docs.aws.amazon.com/zh_tw/singlesignon/latest/userguide/images/emr-tutorial-step-3.1.png)

1. 在**服務角色下，讓 Studio 存取您的資源**，[步驟 1. 建立 EMR Studio 所需的 IAM 角色步驟 2. 建立和設定 EMR Studio](#setting-up-tip-emr-step1)從功能表中選取在 中建立的服務角色。

1. 在**身分驗證**下選擇 **IAM Identity Center**。選取在 中建立的使用者角色[步驟 1. 建立 EMR Studio 所需的 IAM 角色步驟 2. 建立和設定 EMR Studio](#setting-up-tip-emr-step1)。  
![\[步驟 3 在 EMR 主控台中建立 EMR Studio，為身分驗證方法選取 IAM Identity Center。\]](http://docs.aws.amazon.com/zh_tw/singlesignon/latest/userguide/images/emr-tutorial-step-3.3.png)

1. 勾選**信任的身分傳播**方塊。在應用程式存取區段下選擇**僅指派的使用者和群組**，這可讓您僅授予授權的使用者和群組存取此 Studio。

1. *（選用）* - 如果您搭配 EMR 叢集使用此 Studio，則可以設定 VPC 和子網路。  
![\[步驟 4 在 EMR 主控台中建立 EMR Studio，選取網路和安全性設定。\]](http://docs.aws.amazon.com/zh_tw/singlesignon/latest/userguide/images/emr-tutorial-step-3.4.png)

1. 檢閱所有詳細資訊，然後選取**建立 Studio**。

1. 設定 Athena WorkGroup 或 EMR 叢集之後，請登入 Studio 的 URL 以：

   1. 使用查詢編輯器執行 Athena 查詢。

   1. 使用Jupyter筆記本在工作區中執行 Spark 任務。

# 使用 Amazon Athena 的受信任身分傳播
<a name="tip-usecase-ate"></a>

啟用受信任身分傳播的步驟取決於您的使用者是否與 AWS 受管應用程式或客戶受管應用程式互動。下圖顯示用戶端應用程式可信任的身分傳播組態 - AWS 受管或外部 AWS - 使用 Amazon Athena 透過 AWS Lake Formation 和 Amazon S3 提供的存取控制來查詢 Amazon S3 資料Access Grants。

**注意**  
Amazon Athena 的信任身分傳播需要使用 Trino。
不支援透過 ODBC 和 JDBC 驅動程式連接到 Amazon Athena 的 Apache Spark 和 SQL 用戶端。

![\[使用 Athena、Amazon EMR、Lake Formation 和 IAM Identity Center 的受信任身分傳播圖表\]](http://docs.aws.amazon.com/zh_tw/singlesignon/latest/userguide/images/ate-tip-diagram.png)


**AWS 受管應用程式**

下列 AWS 受管用戶端面向應用程式支援 Athena 的受信任身分傳播：
+ Amazon EMR Studio

**若要啟用信任的身分傳播，請遵循下列步驟：**
+ [將 Amazon EMR 設定為 Studio](setting-up-tip-emr.md) Athena 的面向用戶端應用程式。啟用受信任身分傳播時，需要 EMR Studio 中的查詢編輯器來執行 Athena 查詢。
+ [設定 Athena 工作群組](setting-up-tip-ate.md)。
+ [設定 AWS Lake Formation](tip-tutorial-lf.md) 以根據 IAM Identity Center 中的使用者或群組啟用 AWS Glue 資料表的精細存取控制。
+ [設定 Amazon S3 Access Grants](tip-tutorial-s3.md) 以啟用對 S3 中基礎資料位置的暫時存取。

**注意**  
Amazon S3 中對 Athena 查詢結果的存取控制Access Grants需要 Lake Formation AWS Glue Data Catalog 和 Amazon S3。

**客戶受管應用程式**  
若要為*自訂開發應用程式*的使用者啟用受信任身分傳播，請參閱 *AWS 安全部落格*中的[使用受信任身分傳播以 AWS 服務 程式設計方式存取 ](https://aws.amazon.com/blogs//security/access-aws-services-programmatically-using-trusted-identity-propagation/)。

# 使用 Amazon Athena 工作群組設定信任的身分傳播
<a name="setting-up-tip-ate"></a>

下列程序會逐步引導您設定 Amazon Athena 工作群組以進行信任的身分傳播。

## 先決條件
<a name="setting-up-tip-ate-prereqs"></a>

您必須先設定下列項目，才能開始使用本教學課程：

1. [啟用 IAM Identity Center](enable-identity-center.md)。建議使用[組織執行個體](organization-instances-identity-center.md)。如需詳細資訊，請參閱[先決條件和考量事項](trustedidentitypropagation-overall-prerequisites.md)。

1. [將使用者和群組從您的身分來源佈建至 IAM Identity Center](tutorials.md)。

1. 此組態需要 [Amazon EMR Studio](setting-up-tip-emr.md)、 [AWS Lake Formation](tip-tutorial-lf.md)和 [Amazon S3 Access Grants](tip-tutorial-s3.md)。

## 使用 Athena 設定受信任的身分傳播
<a name="setting-up-tip-ate-step1"></a>

若要使用 Athena 設定受信任的身分傳播，Athena 管理員必須：

1. 檢閱[使用啟用 IAM Identity Center 的 Athena 工作群組時的考量和限制](https://docs.aws.amazon.com//athena/latest/ug/workgroups-identity-center.html#workgroups-identity-center-considerations-and-limitations)。

1. [建立已啟用 IAM Identity Center 的 Athena 工作群組](https://docs.aws.amazon.com//athena/latest/ug/workgroups-identity-center.html#workgroups-identity-center-creating-an-identity-center-enabled-athena-workgroup)。

# 使用 Amazon SageMaker Studio 進行信任的身分傳播
<a name="trusted-identity-propagation-usecase-sagemaker-studio"></a>

[Amazon SageMaker Studio](https://docs.aws.amazon.com//sagemaker/latest/dg/studio-updated.html) 與 IAM Identity Center 整合，並支援[使用者背景工作階段](user-background-sessions.md)和信任的身分傳播。使用者背景工作階段允許使用者在 SageMaker Studio 上啟動長時間執行的任務，而不需要該使用者在任務執行時保持登入狀態。任務會立即在背景執行，並使用啟動任務之使用者的許可。即使使用者關閉電腦、IAM Identity Center 登入工作階段過期，或使用者登出 AWS 存取入口網站，任務仍可繼續執行。使用者背景工作階段的預設工作階段持續時間為 7 天，但您可以指定最長 90 天的持續時間。信任的身分傳播允許根據使用者的身分或群組成員資格，將精細存取提供給 Amazon S3 儲存貯體等 AWS 資源。

下圖顯示 SageMaker Studio 的受信任身分傳播組態，可存取存放在 Amazon S3 儲存貯體中的資料。IAM Identity Center 已啟用使用者背景工作階段，這可讓 SageMaker Studio 訓練任務在背景執行。訓練資料的存取控制由 Amazon S3 提供Access Grants。

![\[SageMaker Studio 的受信任身分傳播圖表，以及在使用者背景工作階段中執行的 SageMaker Studio 訓練任務，以及存取 Amazon S3 提供之 Amazon S3 中的訓練資料Access Grants。\]](http://docs.aws.amazon.com/zh_tw/singlesignon/latest/userguide/images/sagemaker-studio-s3-user-background-session-training-job-s3-access-grants-diagram.png)


**AWS 受管應用程式**

下列 AWS 受管用戶端面向應用程式支援受信任的身分傳播：
+ [Amazon SageMaker Studio](setting-up-trusted-identity-propagation-sagemaker-studio.md)

**若要啟用信任的身分傳播和使用者背景工作階段，請遵循下列步驟：**
+ [將 SageMaker Studio 設定為面向用戶端的應用程式。](setting-up-trusted-identity-propagation-sagemaker-studio.md)
+ [設定 Amazon S3 Access Grants](tip-tutorial-s3.md) 以啟用暫時存取 Amazon S3 中的基礎資料位置。

# 使用 SageMaker Studio 設定受信任的身分傳播
<a name="setting-up-trusted-identity-propagation-sagemaker-studio"></a>

下列程序會逐步引導您設定 SageMaker Studio 進行受信任身分傳播和使用者背景工作階段。

## 先決條件
<a name="setting-up-trusted-identity-propagation-sagemaker-studio-prereqs"></a>

您必須先完成下列任務，才能開始使用本教學課程：

1. [啟用 IAM Identity Center](enable-identity-center.md)。組織執行個體為必要項目。如需詳細資訊，請參閱[先決條件和考量事項](trustedidentitypropagation-overall-prerequisites.md)。

1. [將使用者和群組從您的身分來源佈建至 IAM Identity Center](tutorials.md)。

1. [確認已在 IAM Identity Center 主控台中啟用使用者背景工作階段](user-background-sessions.md)。根據預設，會啟用使用者背景工作階段，並將工作階段持續時間設定為 7 天。您可以變更此持續時間。

若要從 SageMaker Studio 設定信任的身分傳播，SageMaker Studio 管理員必須執行下列步驟。

## 步驟 1：在新的或現有的 SageMaker Studio 網域中啟用信任的身分傳播
<a name="setting-up-trusted-identity-propagation-sagemaker-studio-enable-in-domain"></a>

SageMaker Studio 使用網域來組織使用者設定檔、應用程式及其相關資源。若要啟用受信任身分傳播，您必須建立 SageMaker Studio 網域或修改現有網域，如下列程序所述。

1. 開啟 SageMaker AI 主控台，導覽至**網域**，然後執行下列其中一項操作。
   + **使用[組織設定](https://docs.aws.amazon.com//sagemaker/latest/dg/onboard-custom.html#onboard-custom-instructions)建立新的 SageMaker Studio 網域。**

     選擇**為組織設定**，然後執行下列動作：
     + 選擇 **AWS Identity Center** 作為身分驗證方法。
     + 選取**為此網域上的所有使用者啟用受信任身分傳播**核取方塊。
   + **修改現有的 SageMaker Studio 網域。**
     + 選取使用 IAM Identity Center 進行身分驗證的現有網域。
**重要**  
只有使用 IAM Identity Center 進行身分驗證的 SageMaker Studio 網域才支援信任的身分傳播。如果網域使用 IAM 進行身分驗證，則您無法變更身分驗證方法，因此無法啟用信任的身分傳播。
     + [編輯網域設定](https://docs.aws.amazon.com//sagemaker/latest/dg/domain-edit)。編輯**身分驗證和許可**設定，以啟用信任的身分傳播。

1. 繼續[步驟 2：設定預設網域執行角色](#setting-up-trusted-identity-propagation-sagemaker-studio-domain-execution-role)。SageMaker Studio 網域的使用者需要此角色才能存取其他 AWS 服務，例如 Amazon S3。

## 步驟 2：設定預設網域執行角色和角色信任政策
<a name="setting-up-trusted-identity-propagation-sagemaker-studio-domain-execution-role"></a>

*網域執行角色*是 SageMaker Studio 網域代表網域中的所有使用者擔任的 [IAM 角色](https://docs.aws.amazon.com//IAM/latest/UserGuide/id_roles)。您指派給此角色的許可決定 SageMaker Studio 可執行的動作。

1. 若要建立或選取網域執行角色，請執行下列其中一項操作：
   + **使用 [組織的設定](https://docs.aws.amazon.com//sagemaker/latest/dg/onboard-custom.html#onboard-custom-instructions)來建立或選取角色。**
     + 開啟 SageMaker AI 主控台，並遵循**步驟 2：設定角色和 ML 活動**中的主控台指引，以建立新的網域執行角色或選取現有角色。
     + 完成其餘的設定步驟，以建立 SageMaker Studio 網域。
   + **手動建立執行角色。**
     + 開啟 IAM 主控台並[自行建立執行角色](https://docs.aws.amazon.com//sagemaker/latest/dg/sagemaker-roles.html#sagemaker-roles-create-execution-role)。

1. [更新連接至網域執行角色的信任政策](https://docs.aws.amazon.com//IAM/latest/UserGuide/id_roles_update-role-trust-policy.html)，使其包含下列兩個動作： [https://docs.aws.amazon.com//STS/latest/APIReference/API_AssumeRole.html](https://docs.aws.amazon.com//STS/latest/APIReference/API_AssumeRole.html)和 [https://docs.aws.amazon.com//IAM/latest/UserGuide/reference_policies_iam-condition-keys.html](https://docs.aws.amazon.com//IAM/latest/UserGuide/reference_policies_iam-condition-keys.html)。如需有關如何尋找 SageMaker Studio 網域執行角色的資訊，請參閱[取得網域執行角色](https://docs.aws.amazon.com//sagemaker/latest/dg/sagemaker-roles.html#sagemaker-roles-get-execution-role-domain)。

   *信任政策*會指定可擔任角色的身分。此政策是允許 SageMaker Studio 服務擔任網域執行角色的必要政策。新增這兩個動作，使其在您的政策中顯示如下。

   ```
   {
   
       "Version": "2012-10-17", 		 	 	  
   
   
       "Statement": [
           {
               "Effect": "Allow",
               "Principal": {
                   "Service": [
                       "sagemaker.amazonaws.com"
                   ]
               },
               "Action": [
                   "sts:AssumeRole",
                   "sts:SetContext"
               ]
           }
       ]
   }
   ```

## 步驟 3：驗證網域執行角色所需的 Amazon S3 Access Grant 許可
<a name="setting-up-trusted-identity-propagation-sagemaker-studio-s3-access-grant-permissions-execution-role"></a>

若要使用 Amazon S3 Access Grants，您必須將許可政策 （做為內嵌政策或客戶受管政策） 連接至包含下列許可的 SageMaker Studio 網域執行角色。

```
{

    "Version": "2012-10-17", 		 	 	  

    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "s3:GetDataAccess",
                "s3:GetAccessGrantsInstanceForPrefix"
                ],
            "Resource": "arn:aws:s3:us-east-2:111122223333:access-grants/default"
        }
    ]
}
```

如果您沒有包含這些許可的政策，請遵循*AWS Identity and Access Management 《 使用者指南*》中的[新增和移除 IAM 身分許可](https://docs.aws.amazon.com//IAM/latest/UserGuide/access_policies_manage-attach-detach.html)中的指示。

## 步驟 4：將群組和使用者指派給網域
<a name="setting-up-trusted-identity-propagation-sagemaker-studio-assign-users-groups-to-domain"></a>

遵循[新增群組和使用者中的步驟，將群組和使用者](https://docs.aws.amazon.com//sagemaker/latest/dg/domain-groups-add.html)指派給 SageMaker Studio 網域。

## 步驟 5：設定 Amazon S3 Access Grants
<a name="setting-up-trusted-identity-propagation-sagemaker-studio-set-up-s3-access-grants"></a>

若要設定 Amazon S3 Access Grants，請遵循[透過 IAM Identity Center 為受信任身分傳播設定 Amazon S3 Access Grants ](tip-tutorial-s3.md#tip-tutorial-s3-configure)中的步驟。使用step-by-step說明來完成下列任務：

1. 建立 Amazon S3 Access Grants 執行個體。

1. 在該執行個體中註冊位置。

1. 建立授予，以允許特定 IAM Identity Center 使用者或群組存取這些位置中指定的 Amazon S3 位置或子集 （例如特定字首）。

## 步驟 6：提交 SageMaker 訓練任務並檢視使用者背景工作階段詳細資訊
<a name="setting-up-trusted-identity-propagation-sagemaker-studio-submit-training-job-view-user-background-session-details"></a>

在 SageMaker Studio 中，啟動新的 Jupyter 筆記本並提交訓練任務。任務執行時，請完成下列步驟以檢視工作階段資訊，並確認使用者背景工作階段內容處於作用中狀態。

1. 開啟 IAM Identity Center 主控台。

1. 選擇 **Users** (使用者)。

1. 在**使用者**頁面上，選擇您要管理其工作階段的使用者名稱。這會帶您前往包含使用者資訊的頁面。

1. 在使用者頁面上，選擇**作用中工作階段**索引標籤。**作用中工作階段**旁的括號中的數字表示此使用者的作用中工作階段數量。

1. 若要依使用工作階段之任務的 Amazon Resource Name (ARN) 搜尋工作階段，請在**工作階段類型**清單中，選擇**使用者背景工作階段**，然後在搜尋方塊中輸入任務 ARN。

以下是使用使用者背景工作階段的訓練任務如何在使用者的 **Active 工作階段**索引標籤中顯示的範例。

![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/singlesignon/latest/userguide/images/sagemaker-studio-training-job-displayed-in-identity-center-console-active-sessions.png)


## 步驟 7：檢視 CloudTrail 日誌以驗證 CloudTrail 中信任的身分傳播
<a name="setting-up-trusted-identity-propagation-sagemaker-studio-view-cloudtrail-logs"></a>

啟用信任的身分傳播時，動作會顯示在 `onBehalfOf`元素下的 CloudTrail 事件日誌中。`userId` 反映啟動訓練任務的 IAM Identity Center 使用者的 ID。下列 CloudTrail 事件會擷取信任身分傳播的程序。

```
                            "userIdentity": {
    "type": "AssumedRole",
    "principalId": "AROA123456789EXAMPLE:SageMaker",
    "arn": "arn:aws:sts::111122223333:assumed-role/SageMaker-ExecutionRole-20250728T125817/SageMaker",
    "accountId": "111122223333",
    "accessKeyId": "ASIAIOSFODNN7EXAMPLE",
    "sessionContext": {
        "sessionIssuer": {
            "type": "Role",
            "principalId": "AROA123456789EXAMPLE",
            "arn": "arn:aws:iam::111122223333:role/service-role/SageMaker-ExecutionRole-20250728T125817",
            "accountId": "111122223333",
            "userName": "SageMaker-ExecutionRole-20250728T125817"
        },
        "attributes": {
            "creationDate": "2025-07-29T17:17:10Z",
            "mfaAuthenticated": "false"
        }
    },
    "onBehalfOf": {
        "userId": "2801d3e0-f0e1-707f-54e8-f558b19f0a10",
        "identityStoreArn": "arn:aws:identitystore::777788889999:identitystore/d-1234567890"
    }
},
```

## 執行時期考量
<a name="setting-up-trusted-identity-propagation-sagemaker-ai-runtime-considerations"></a>

如果管理員為長時間執行的訓練或處理任務設定了 **MaxRuntimeInSeconds**，而該任務低於使用者背景工作階段持續時間，則 SageMaker Studio 會執行任務的最短期限為 **MaxRuntimeInSeconds ** 或使用者背景工作階段持續時間。

如需 **MaxRuntimeInSeconds** 的詳細資訊，請參閱《*Amazon SageMaker API 參考*》中的 `CreateTrainingJob` [StoppingCondition](https://docs.aws.amazon.com//sagemaker/latest/APIReference/API_CreateTrainingJob.html#sagemaker-CreateTrainingJob-request-StoppingCondition) 參數指南。