All Products
Search
Document Center

Identity as a Service:Auto role SSO with Alibaba Cloud RAM

Last Updated:Mar 31, 2026

Integrate IDaaS EIAM with Alibaba Cloud Resource Access Management (RAM) to enable automatic role-based single sign-on (SSO) for user groups. Users added to a group automatically inherit the corresponding RAM role — no per-account application configuration required.

How it works

A user's group membership in IDaaS drives role selection at logon time. When a user accesses the SAML 2.0 application, IDaaS builds a SAML assertion that maps each group the user belongs to a RAM role (via the group's External ID). RAM evaluates the assertion and presents the matching roles for the user to select.

The full setup involves five stages:

  1. Create a SAML application in IDaaS and connect it to the RAM SAML metadata.

  2. Create a SAML identity provider (IdP) and RAM roles so RAM trusts assertions from IDaaS.

  3. Create users and groups in IDaaS, then grant the application access to those groups.

  4. Configure SAML Attribute Statements to map group membership to RAM roles at runtime.

  5. Verify that users can log on and select the expected roles.

Prerequisites

Before you begin, ensure that you have:

  • An active IDaaS EIAM instance

  • Access to the IDaaS console and the RAM console

  • Your Alibaba Cloud account ID (available on the Alibaba Cloud home page) — required when configuring SAML Attribute Statements in Step 4

Step 1: Create a SAML application

1a. Add the application in IDaaS

  1. Log on to the IDaaS console, select your IDaaS instance, and in the Actions column click Console.IDaaS console

  2. Go to Applications > Add Application > Standard Protocol to create a SAML 2.0 application. image

  3. Enter an application name and click Add.

1b. Connect the application to the RAM SAML metadata

  1. In the RAM console, go to Integrations > SSO and copy the SAML service provider metadata URL. image

  2. Back on the SAML 2.0 application configuration page in IDaaS, paste the URL into the Enter the URL of the metadata field and click Parse. image

  3. Download the IdP Metadata file. You'll upload this XML file to RAM in Step 2. image

Step 2: Create a SAML IdP and RAM roles

2a. Create the SAML identity provider in RAM

Important

The IdP metadata file must be in XML format. It contains the IdP logon service endpoint, the public key for signature verification, and the assertion format.

  1. Log on to the RAM console with your Alibaba Cloud account. Go to Integrations > SSO.

  2. On the Role-based SSO tab, click the SAML tab, then click Create Identity Provider.

  3. On the Create IdP page, enter an IdP Name. This guide uses idaas-saml-standard as an example.

  4. In the Metadata File section, click Upload Metadata File, upload the IdP metadata file you downloaded in Step 1, and click Create IdP. image

Save the IdP name (for example, idaas-saml-standard). You'll reference it in the SAML Attribute Statements in Step 4.

2b. Create RAM roles

  1. In the RAM console, go to Identities > Roles and click Create Role. image

  2. On the Create Role page, click Switch to Policy Editor in the upper-right corner. image

  3. In the editor, select the SAML IdP you created above. image

  4. Click OK, enter the role name role1, and click OK again. image

  5. Repeat to create role2. image

Step 3: Set up users and groups in IDaaS

3a. Create a user

In the IDaaS console, go to Account > Accounts and Orgs and click Create Account to create a user. This guide uses emp001 as an example. image

3b. Create groups

Each group maps to a RAM role through its External ID. The External ID must exactly match the RAM role name.

  1. Go to Account > Group and click Create Group.

  2. Set Group Name to group01 and External ID to role1. image

  3. Create a second group: Group Name group02, External ID role2.

  4. Add emp001 to both groups. image image

3c. Grant application access

On the details page of the SAML 2.0 application, go to Sign-In > Authorize and grant access to emp001, group01, and group02.

Step 4: Configure SAML Attribute Statements

On the SAML 2.0 application details page, click Show Advanced Settings and add the following two Attribute Statements. image

Attribute Statement 1 — Role mapping

FieldValue
Keyhttps://www.aliyun.com/SAML-Role/Attributes/Role
ValueSamlArray(ArrayMap(user.groups, StringReplace("acs:ram::$uid:role/$roleName,acs:ram::$uid:saml-provider/$idp", "$roleName", __item.groupExternalId)))

Replace the placeholders before saving:

PlaceholderDescription
$uidYour Alibaba Cloud account ID. You can find this ID on the Alibaba Cloud home page.
$idpReplace this with the name of the identity provider that you created in Step 2.

Attribute Statement 2 — Session name

FieldValue
Keyhttps://www.aliyun.com/SAML-Role/Attributes/RoleSessionName
Valueuser.username
image

Verify the configuration

  1. Log on to the IDaaS EIAM portal with the emp001 account and open the SAML 2.0 application. IDaaS automatically redirects you to the Alibaba Cloud Management Console. image

  2. On the role selection page, select role1 or role2 to complete logon. image

If both roles appear and logon succeeds, the configuration is complete.

How group-based permissions work

Adding a user to a group automatically grants them access to every application the group is authorized for, including the role mapping defined by the group's External ID. This approach provides:

  • Centralized control: Manage role mappings at the group level rather than per account.

  • Easy onboarding: Add new users to the appropriate group — no additional authorization steps required.

  • Consistent permissions: All members of a group follow the same SAML assertion rules.

  • Reduced overhead: Eliminates repetitive per-account authorization policies.