

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

# 使用 更新以資源為基礎的委派政策 AWS Organizations
<a name="orgs-policy-delegate-update"></a>

從管理帳戶，更新組織的資源型委派政策，並新增指定哪些成員帳戶可以對政策執行動作的陳述式。您可以在政策中新增多個陳述式，以表示成員帳戶的不同許可集。

**最低許可**  
若要更新以資源為基礎的委派政策，您需要執行下列動作的許可：  
`organizations:PutResourcePolicy`
`organizations:DescribeResourcePolicy` 
此外，您必須授與委派管理員帳戶中的角色和使用者對應的 IAM 許可，以執行必要動作。如果沒有 IAM 許可，則假設呼叫主體沒有管理 AWS Organizations 政策所需的許可。

------
#### [ AWS 管理主控台 ]

使用以下其中一個方法，在 AWS 管理主控台 中將陳述式新增至以資源為基礎的委派政策：
+ **JSON 政策** – 貼上並自訂要在帳戶中使用的範例資源型委派政策，或在 JSON 編輯器中輸入您自己的 JSON 政策文件。
+ **視覺化編輯器** – 在視覺化編輯器中建構新的委派政策，此政策會引導您建立委派政策，而不需要撰寫 JSON 語法。

**使用 JSON 政策編輯器更新委派政策**

1. 登入 [AWS Organizations 主控台](https://console.aws.amazon.com/organizations/v2)。您必須以 IAM 使用者登入、擔任 IAM 角色，或是以組織管理帳戶中的根使用者 ([不建議](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) 身分登入。

1. 選擇**設定**。

1. 在 **的委派管理員 AWS Organizations**區段中，選擇**編輯**以更新 Organizations 委派政策。

1. 輸入 JSON 政策文件。如需有關 IAM 政策語言的詳細資訊，請參閱 [IAM JSON 政策參考](https://docs.aws.amazon.com//IAM/latest/UserGuide/reference_policies.html)。

1. 解決政策驗證期間產生的任何[安全警告、錯誤或一般警告](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_policy-validator.html)，然後選擇**建立政策**。

**使用視覺化編輯器更新委派政策**

1. 登入 [AWS Organizations 主控台](https://console.aws.amazon.com/organizations/v2)。您必須以 IAM 使用者登入、擔任 IAM 角色，或是以組織管理帳戶中的根使用者 ([不建議](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) 身分登入。

1. 選擇**設定**。

1. 在 **的委派管理員 AWS Organizations**區段中，選擇**編輯**以更新 Organizations 委派政策。

1. 在 **Create Delegation policy** (建立委派政策) 頁面上，選擇 **Add new statement** (新增陳述式)。

1. 將 **Effect** (效果) 設定為 `Allow`。

1. 新增 `Principal` 以定義您要委派的成員帳戶。

1. 從 **Actions** (動作) 清單中，選擇您要委派的動作。您可使用 **Filter actions** (篩選動作)，以縮減選項。

1. 若要指定委派的成員帳戶是否可將政策連接至組織根目錄或組織單位 (OU)，請設定 `Resources`。您也必須選取 `policy` 作為資源類型。您可採用以下方式來指定資源：
   + 選擇 **Add a resource** (新增資源)，並按照對話方塊中的提示建構 Amazon Resource Name (ARN)。
   + 在編輯器中手動列出資源 ARN。如需 ARN 語法的詳細資訊，請參閱《 AWS 一般參考指南》中的 [Amazon Resource Name (ARN)](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)。如需有關在政策資源元素中使用 ARN 的詳細資訊，請參閱 [IAM JSON 政策元素：Resource](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_resource.html)。

1. 選擇 **Add a condition** (新增條件) 以指定其他條件，包括您要委派的政策類型。選擇條件的 **Condition key** (條件索引鍵)、**Tag key** (標籤索引鍵)、**Qualifier** (修飾詞) 以及 **Operator** (運算子)，然後輸入 **Value**。完成時，請選擇 **Add condition** (新增條件)。如需有關 **Condition** (條件) 元素的詳細資訊，請參閱 IAM JSON 政策參考中的 [IAM JSON 政策元素：Condition](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html)。

1. 若要新增更多許可區塊，請選擇 **Add new statement ** (新增陳述式)。針對每個區塊皆重複步驟 5 到 9。

1. 解決[政策驗證](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_policy-validator.html)期間產生的任何安全警告、錯誤或一般警告，然後選擇**儲存政策**。

------
#### [ AWS CLI & AWS SDKs ]

**建立或更新委派政策**  
您可以使用下列命令來建立或更新委派政策：
+ AWS CLI：[put-resource-policy](https://docs.aws.amazon.com/cli/latest/reference/organizations/put-resource-policy.html)

  以下範例會建立或更新委派政策。

  ```
  $ aws organizations put-resource-policy --content
  {
      "Version": "2012-10-17",		 	 	 
      "Statement": [
          {
              "Sid": "Fully_manage_backup_policies",
              "Effect": "Allow",
              "Principal": {
                  "AWS": "135791357913"
              },
              "Action": [
                  "organizations:DescribeOrganization",
                  "organizations:ListAccounts",
                  "organizations:CreatePolicy",
                  "organizations:DescribePolicy",
                  "organizations:UpdatePolicy",
                  "organizations:DeletePolicy",
                  "organizations:AttachPolicy",
                  "organizations:DetachPolicy"
              ],
              "Resource": [
                  "arn:aws:organizations::246802468024:root/o-abcdef/r-pqrstu",
                  "arn:aws:organizations::246802468024:ou/o-abcdef/*",
                  "arn:aws:organizations::246802468024:account/o-abcdef/*",
                  "arn:aws:organizations::246802468024:organization/policy/backup_policy/*",
              ],
              "Condition": {
                  "StringLikeIfExists": {
                      "organizations:PolicyType": [
                          "BACKUP_POLICY"
                      ]
                  }
              }
          }
      ]
  }
  ```
+ AWS 開發套件：[PutResourcePolicy](https://docs.aws.amazon.com/organizations/latest/APIReference/API_PutResourcePolicy.html)

------

**支援的委派政策動作**  
委派政策支援下列動作：
+ `AttachPolicy`
+ `CreatePolicy`
+ `DeletePolicy`
+ `DescribeAccount`
+ `DescribeCreateAccountStatus`
+ `DescribeEffectivePolicy`
+ `DescribeHandshake`
+ `DescribeOrganization`
+ `DescribeOrganizationalUnit`
+ `DescribePolicy`
+ `DescribeResourcePolicy`
+ `DetachPolicy`
+ `DisablePolicyType`
+ `EnablePolicyType`
+ `ListAccounts`
+ `ListAccountsForParent`
+ `ListAWSServiceAccessForOrganization`
+ `ListChildren`
+ `ListCreateAccountStatus`
+ `ListDelegatedAdministrators`
+ `ListDelegatedServicesForAccount`
+ `ListHandshakesForAccount`
+ `ListHandshakesForOrganization`
+ `ListOrganizationalUnitsForParent`
+ `ListParents`
+ `ListPolicies`
+ `ListPoliciesForTarget`
+ `ListRoots`
+ `ListTagsForResource`
+ `ListTargetsForPolicy`
+ `TagResource`
+ `UntagResource`
+ `UpdatePolicy`

**支援的條件索引鍵**  
只有 支援的條件金鑰 AWS Organizations 可用於委派政策。如需詳細資訊，請參閱*《服務授權參考*》中的 [的條件金鑰 AWS Organizations](https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsorganizations.html#awsorganizations-policy-keys)。