

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

# 開發人員工具主控台中的功能如何與 IAM 搭配使用
<a name="security_iam_service-with-iam"></a>

使用 IAM 管理開發人員工具主控台功能的存取權前，應先了解可與此主控台搭配使用的 IAM 功能有哪些。若要全面了解通知和其他 AWS 服務如何與 IAM 搭配使用，請參閱《IAM *使用者指南*》中的與 IAM [AWS 搭配使用的 服務](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-services-that-work-with-iam.html)。

**Topics**
+ [開發人員工具主控台中的身分型政策](#security_iam_service-with-iam-id-based-policies)
+ [AWS CodeStar Notifications 和 AWS CodeConnections 資源型政策](#security_iam_service-with-iam-resource-based-policies)
+ [以標籤為基礎的授權](#security_iam_service-with-iam-tags)
+ [IAM 角色](#security_iam_service-with-iam-roles)

## 開發人員工具主控台中的身分型政策
<a name="security_iam_service-with-iam-id-based-policies"></a>

使用 IAM 身分型政策，您可以指定允許或拒絕的動作和資源，以及在何種條件下允許或拒絕動作。 AWS CodeStar Notifications 和 AWS CodeConnections 支援特定動作、資源和條件索引鍵。若要了解您在 JSON 政策中使用的所有元素，請參閱《*IAM 使用者指南*》中的 [IAM JSON 政策元素參考](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements.html)。

### 動作
<a name="security_iam_service-with-iam-id-based-policies-actions"></a>

管理員可以使用 AWS JSON 政策來指定誰可以存取內容。也就是說，哪個**主體**在什麼**條件**下可以對什麼**資源**執行哪些**動作**。

JSON 政策的 `Action` 元素描述您可以用來允許或拒絕政策中存取的動作。政策會使用動作來授予執行相關聯動作的許可。

開發人員工具主控台中通知的政策動作在動作前面使用下列字首：`codestar-notifications and codeconnections`。例如，若要授予某人檢視其帳戶中的所有通知規則，請在其政策中包含 `codestar-notifications:ListNotificationRules` 動作。政策陳述式必須包含 `Action`或 `NotAction`元素。 AWS CodeStar Notifications 和 AWS CodeConnections 會定義自己的一組動作，描述您可以使用此服務執行的任務。

若要在單一陳述式中指定多個 AWS CodeStar Notifications 動作，請以逗號分隔它們，如下所示。

```
"Action": [
      "codestar-notifications:action1",
      "codestar-notifications:action2"
```

若要在單一陳述式中指定多個 AWS CodeConnections 動作，請以逗號分隔它們，如下所示。

```
"Action": [
      "codeconnections:action1",
      "codeconnections:action2"
```

您也可以使用萬用字元 (\$1) 來指定多個動作。例如，如需指定開頭是 `List` 文字的所有動作，請包含以下動作：

```
"Action": "codestar-notifications:List*"
```



AWS CodeStar Notifications API 動作包括：
+ `CreateNotificationRule`
+ `DeleteNotificationRule`
+ `DeleteTarget`
+ `DescribeNotificationRule`
+ `ListEventTypes`
+ `ListNotificationRules`
+ `ListTagsForResource`
+ `ListTargets`
+ `Subscribe`
+ `TagResource`
+ `Unsubscribe`
+ `UntagResource`
+ `UpdateNotificationRule`

AWS CodeConnections API 動作包括下列項目：
+ `CreateConnection`
+ `DeleteConnection`
+ `GetConnection`
+ `ListConnections`
+ `ListTagsForResource`
+ `TagResource`
+ `UntagResource`

在 中需要下列僅限許可的動作 AWS CodeConnections ，才能完成身分驗證交握：
+ `GetIndividualAccessToken`
+ `GetInstallationUrl`
+ `ListInstallationTargets`
+ `StartOAuthHandshake`
+ `UpdateConnectionInstallation`

在 中需要下列僅限許可的動作 AWS CodeConnections 才能使用連線：
+ `UseConnection`

在 中需要下列僅限許可的動作， AWS CodeConnections 才能將連線傳遞至服務：
+ `PassConnection`

若要查看 AWS CodeStar Notifications 和 AWS CodeConnections 動作的清單，請參閱《*IAM 使用者指南*》中的[AWS CodeStar Notifications 定義的動作](https://docs.aws.amazon.com/IAM/latest/UserGuide/list_codestarnotifications.html#codestarnotifications-actions-as-permissions)和[AWS CodeConnections 定義的動作](https://docs.aws.amazon.com/IAM/latest/UserGuide/list_codestarconnections.html#codestarconnections-actions-as-permissions)。

### Resources
<a name="security_iam_service-with-iam-id-based-policies-resources"></a>

AWS CodeStar Notifications 和 AWS CodeConnections 不支援在政策中指定資源 ARNs。

### 條件索引鍵
<a name="security_iam_service-with-iam-id-based-policies-conditionkeys"></a>

AWS CodeStar Notifications 和 AWS CodeConnections 會定義自己的一組條件金鑰，也支援使用一些全域條件金鑰。若要查看所有 AWS 全域條件索引鍵，請參閱《*IAM 使用者指南*》中的[AWS 全域條件內容索引鍵](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html)。

 

All AWS CodeStar Notifications 動作支援 `codestar-notifications:NotificationsForResource`條件金鑰。如需詳細資訊，請參閱[身分型政策範例](security_iam_id-based-policy-examples.md)。

AWS CodeConnections 定義下列條件索引鍵，可用於 IAM 政策的 `Condition`元素。您可以使用這些索引鍵來縮小套用政策陳述式的條件。如需詳細資訊，請參閱[AWS CodeConnections 許可參考](security-iam.md#permissions-reference-connections)。


| 條件索引鍵 | Description | 
| --- | --- | 
|  `codeconnections:BranchName`  | 根據第三方儲存庫的分支名稱來篩選存取權 | 
|  `codeconnections:FullRepositoryId`  | 透過請求中傳遞的儲存庫來篩選存取。僅適用於用來存取特定儲存庫的 UseConnection 請求 | 
| codeconnections:InstallationId | 根據用來更新連線的第三方 ID (例如 Bitbucket 應用程式安裝 ID) 來篩選存取權。可讓您限制哪些第三方應用程式安裝可以用來建立連線 | 
| codeconnections:OwnerId | 根據第三方供應商的擁有者或帳戶 ID 來篩選存取權 | 
|  `codeconnections:PassedToService`  | 根據委託人允許傳遞連線的服務來篩選存取權 | 
|  `codeconnections:ProviderAction`  | 根據 UseConnection 請求中的供應商動作 (例如 ListRepositories) 來篩選存取權。 | 
| codeconnections:ProviderPermissionsRequired | 根據第三方供應商許可類型來篩選存取權 | 
|  `codeconnections:ProviderType`  | 根據請求中傳遞的第三方供應商類型來篩選存取 | 
| codeconnections:ProviderTypeFilter | 根據用來篩選結果的第三方供應商類型來篩選存取 | 
| codeconnections:RepositoryName | 根據第三方儲存庫名稱來篩選存取權 | 

### 範例
<a name="security_iam_service-with-iam-id-based-policies-examples"></a>



若要檢視 AWS CodeStar Notifications 和 AWS CodeConnections 身分型政策的範例，請參閱 [身分型政策範例](security_iam_id-based-policy-examples.md)。

## AWS CodeStar Notifications 和 AWS CodeConnections 資源型政策
<a name="security_iam_service-with-iam-resource-based-policies"></a>

AWS CodeStar Notifications 和 AWS CodeConnections 不支援以資源為基礎的政策。

## 以標籤為基礎的授權
<a name="security_iam_service-with-iam-tags"></a>

您可以將標籤連接至 AWS CodeStar Notifications 和 AWS CodeConnections 資源，或在請求中傳遞標籤。如需根據標籤控制存取，請使用 `codestar-notifications and codeconnections:ResourceTag/key-name`、`aws:RequestTag/key-name` 或 `aws:TagKeys` 條件索引鍵，在政策的[條件元素](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html)中，提供標籤資訊。如需標記策略的詳細資訊，請參閱[標記 AWS 資源](https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html)。如需標記 AWS CodeStar Notifications 和 AWS CodeConnections 資源的詳細資訊，請參閱 [標記連線資源](connections-tag.md)。

若要檢視身分型政策範例，用於根據該資源的標籤來限制資源的存取權，請參閱「[使用標籤控制對 AWS CodeConnections 資源的存取](connections-tag-based-access-control.md)」。

## IAM 角色
<a name="security_iam_service-with-iam-roles"></a>

[IAM 角色](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html)是您 AWS 帳戶中具有特定許可的實體。

### 使用暫時登入資料
<a name="security_iam_service-with-iam-roles-tempcreds"></a>

您可以搭配聯合功能使用暫時憑證來登入、擔任 IAM 角色或跨帳戶角色。您可以透過呼叫 [AssumeRole](https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html) 或 [GetFederationToken](https://docs.aws.amazon.com/STS/latest/APIReference/API_GetFederationToken.html) 等 AWS STS API 操作來取得臨時安全登入資料。

AWS CodeStar Notifications 和 AWS CodeConnections 支援使用臨時登入資料。

### 服務連結角色
<a name="security_iam_service-with-iam-roles-service-linked"></a>

[服務連結角色](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_terms-and-concepts.html#iam-term-service-linked-role)可讓 AWS 服務存取其他服務中的資源，以代表您完成 動作。服務連結角色會顯示在您的 IAM 帳戶中，並由該服務所擁有。IAM 管理員可以檢視，但不能編輯服務連結角色的許可。

AWS CodeStar Notifications 支援服務連結角色。如需建立或管理 AWS CodeStar Notifications 和 AWS CodeConnections 服務連結角色的詳細資訊，請參閱 [使用 AWS CodeStar Notifications 的服務連結角色](using-service-linked-roles.md)。

CodeConnections 不支援服務連結角色。