Updated on 2026-10-22 GMT+08:00

Creating a Trust Agency for a SAML Identity Provider

You can implement SAML 2.0 identity federation to allow users to access your Huawei Cloud resources without creating dedicated IAM users in your account. By configuring a SAML identity provider (IdP), you can manage user identities in your external directory while controlling their access permissions within Huawei Cloud. For more information about identity federation, see Identity Providers.

Prerequisites

  1. You have created a SAML 2.0-based IdP in IAM. For more details, refer to Creating a SAML Identity Provider.
  2. You have configured the required policies for switching to the target trust agency of the IdP. A trust agency configured for SAML identity federation uses two types of policies to manage access:

    • Trust policy: specifies the trust IdP or principal allowed to assume the agency.
    • Identity policy: defines the specific cloud service actions that the federated users can perform and the Huawei Cloud resources they can access once they assume the agency.
    To guarantee that only your specific application can assume the trust agency, you have enforced the following structural configurations within your trust policy:
    • Add sts:agencies:assumeWithSAML to the Action element.
      "Action": [
          "sts:agencies:assumeWithSAML"
      ]
    • Add {"Federated":providerUrn} to the Principal element and use the URN of the SAML IdP created in step 1, for example:
      "Principal": {
          "Federated": [
              "iam::{account-id}:samlProvider:{provider-name}"
          ]
      }
    • Use the StringEquals condition key in the Condition element to check whether the saml:aud attribute in the SAML response matches the login URL. The login URL corresponds to the Recipient attribute in the SAML assertion. Write a Condition element similar to the following example based on the identity provider:
      "Condition": {
          "StringEquals": {
              "saml:aud": [
                  "https://auth.huawei.com/saml/acs/{provider_id}"
              ]
          }
      }
  3. If SAML encryption is required, the login URL must include the SAML identity provider ID allocated by Huawei Cloud. You can find this ID by navigating to the Identity Providers page on the IAM console and viewing the IdP details. The following is an example of a login URL with SAML encryption enabled:
    https://auth.huawei.com/saml/acs/{provider_id}
    The following is an example trust policy for the trust agency of a SAML IdP:
    {
      "Version": "5.0",
      "Statement": [
        {
          "Action": [
            "sts:agencies:assumeWithSAML"
          ],
          "Effect": "Allow",
          "Condition": {
            "StringEquals": {
              "saml:aud": [
                "https://auth.huawei.com/saml/acs/{provider_id}"
              ]
            }
          },
          "Principal": {
            "Federated": [
              "iam::{account-id}:samlProvider:{provider_name}"
            ]
          }
        }
      ]
    }

    Replace the principal URN with the actual URN of the SAML IdP you created in IAM. It contains your Huawei Cloud account ID and the name of the IAM SAML IdP.

Procedure

  1. Log in to the new IAM console.
  2. On the IAM console, choose Agencies in the navigation pane and click Create Trust Agency in the upper right corner.
  3. Enter a trust agency name.
    Figure 1 Creating a trust agency for a SAML IdP

    Once a trust agency is created, its name cannot be changed.

  4. Select Identity Provider and set the Identity Provider Type to SAML.
  5. In the SAML Identity Provider drop-down list, select a SAML IdP for your trust agency.
  6. Set Maximum Session Duration to the maximum session duration of temporary access credentials obtained by programmatic access.
  7. (Optional) Enter a brief description.
  8. (Optional) Configure one or more SAML attributes and their corresponding values to restrict trust agency switching to only users whose assertions contain those matching attributes. Note that the audience (aud) attribute is mandatory.
    Figure 2 Adding a condition

    The list of available condition keys includes the most commonly used SAML attributes. You can view all SAML-related condition keys by referring to the "Conditions" section of the STS service in the Identity Policy–based Authorization.

  9. After the trust agency is created, click Authorize to attach identity policies to it. If no policy is attached, the trust agency lacks permissions by default.

Once creation and authorization are complete, you can map this configuration with the SAML assertions in your external IdP. This allows SAML-federated users to switch to this trust agency, obtaining temporary credentials to access the Huawei Cloud resources within the target account.