Help Center/ Identity and Access Management/ Best Practices/ Agency Configuration/ Authorizing IAM Users to Manage Resources of an Account
Updated on 2023-06-20 GMT+08:00

Authorizing IAM Users to Manage Resources of an Account

Company B is a professional O&M company. It becomes a delegated party after being authorized by company A. Company B assigns permissions to one or more of its IAM users to manage company A's resources.

Requirements

  • Company B wants to authorize its employees (IAM users) to manage the delegated resources of company A.
  • If company A creates multiple agencies for company B, company B can allocate the agencies to different employees. This will allow each employee to only manage resources of specific agencies.

Solution

  • Account B creates users on the IAM console, and grants the permissions (including Agent Operator) required for managing delegated resources to the users.
  • Account B creates a custom policy with only the permissions required to manage the delegated resources of an agency. Then, account B attaches the policy to the group to which a user belongs, so that the user can only manage the resources of the agency.

Procedure

Account B performs the following procedure to authorize IAM users to manage resources of specific agencies. After authorization, the IAM users of account B can switch their roles to account A to manage account A's resources. To do this, account B needs to have obtained the account (HUAWEI ID), agency name, and agency ID of the delegating party.

  1. Create a user group and grant permissions to it.

    1. In the navigation pane, choose User Groups.
    2. On the User Groups page, click Create User Group.
    3. Enter the user group name, for example, Agency Management.
    4. Click OK.

      The user group is displayed in the user group list.

    5. In the row containing the target user group, click Authorize.
      • To authorize a user to manage only the resources of a specific agency, perform the following steps.
      • To authorize a user to manage the resources of all agencies, go to the next step.
      1. On the Select Policy/Role page, click Create Policy in the upper right.
      2. Enter a policy name, for example, Agency 1 for Managing Company A.
      3. Select JSON for Policy View.
      4. In the Policy Content area, enter the following content:
        {
                "Version": "1.1",
                "Statement": [
                        {
                                "Action": [
                                        "iam:agencies:assume"
                                ],
                                "Resource": {
                                        "uri": [
                                                "/iam/agencies/b36b1258b5dc41a4aa8255508xxx..."
                                        ]
                                },
                                "Effect": "Allow"
                        }
                ]
        }

        Replace b36b1258b5dc41a4aa8255508xxx... with the agency ID obtained from a delegating party. Do not make any other changes.

      5. Click Next.
    6. Select the Agency 1 for Managing Company A agency created in the previous step or the Agent Operator role.
      • The custom policy allows the user only to manage resources of a specific agency ID.
      • The Agent Operator role allows the user to manage the resources of all agencies.
    7. Specify the authorization scope.
    8. Click OK.

  2. Create a user and add the user to the user group.

    1. In the navigation pane, choose Users.
    2. On the Users page, click Create User.
    3. On the Create User page, enter a username and email address.
    4. For Access Type, select Management console access.
    5. For Credential Type, select Set by user.
    6. Enable login protection, select a verification mode, and click Next.
    7. Select the user group Agency Management created in 2 and click Create.

  3. Switch the role.

    1. Log in to HUAWEI CLOUD as the user created in 2. For more information, see Logging In as an IAM User.
    2. Click the username in the upper right corner, and choose Switch Role.

    3. Enter the account name of the delegating party. The agency created by the delegating party is displayed automatically.

      If an agency other than the agencies created by the delegating party is displayed, a message is displayed indicating that you do not have access permissions. Select the correct agency in the Agency Name drop-down list box.

    4. Click OK to switch to the delegating account.