Configure single sign-on (SSO) between Active Directory Federation Services (AD FS) and CloudSSO using the SAML 2.0 protocol.
Background
An enterprise uses Active Directory (AD) for on-premises user management and has a multi-account structure in Alibaba Cloud Resource Directory. AD users need SSO access to designated resources in specific member accounts.
This example uses AD FS on a Windows Server 2012 R2 ECS instance. AD FS serves as the identity provider (IdP) and CloudSSO as the service provider (SP).
The AD and AD FS configurations in this topic are for guidance only. Alibaba Cloud does not provide consulting services for AD or AD FS.
Prerequisites
Before you configure SSO, complete the following tasks:
-
Deploy the following services on a Windows Server 2012 R2 ECS instance.
-
Active Directory Domain Services (AD DS): Manages domain objects such as users and devices.
-
Active Directory Federation Services (AD FS): Handles SSO relying party configuration and authentication.
Important
-
-
Create users and configure permissions in CloudSSO.
-
Create a user in CloudSSO with a username that matches the AD FS SSO field.
For more information, see Create a user.
NoteThe CloudSSO username must match the AD FS SSO field. For more information, see Step 3: Configure SAML assertion attributes in AD FS.
-
Create an access configuration to define permission policies.
For more information, see Create a permission set.
-
Assign access permissions on resource directory accounts.
For more information, see Assign access to a member account.
-
Step 1: Obtain the SP metadata from CloudSSO
Log on to the CloudSSO console.
In the left-side navigation pane, click Settings.
In the SSO Logon section, click the download link to save the service provider (SP) metadata file to your local machine.
Step 2: Add Alibaba Cloud as a relying party in AD FS
-
Log on to the ECS instance where AD FS is deployed.
-
Open Server Manager.
-
In the left-side navigation pane, click AD FS.
-
In the upper-right menu bar, choose .
-
In the AD FS Management console, add Alibaba Cloud as a relying party.
-
In the left-side navigation pane, right-click Relying Party Trusts, and then click Add Relying Party Trust.
-
In the Add Relying Party Trust Wizard, select Claims aware, and then click Start.
-
Select Import data about the relying party from a file, click Browse to import the SP metadata file obtained in Step 1: Obtain the SP metadata from CloudSSO, and then click Next.
-
Enter a display name for the relying party, and then click Next.
This example uses CloudSSODemo.
-
Select an access control policy, and then click Next.
This example uses Permit everyone.
-
Review your settings, and then click Next.
-
Click Close.
-
Step 3: Configure SAML assertion attributes in AD FS
In this example, the NameID field in the SAML assertion is set to the User Principal Name (UPN) of the AD user, which CloudSSO uses to identify the user.
-
Right-click the CloudSSODemo relying party, and then click Edit Claim Issuance Policy.
-
Click Add Rule.
NoteAn issuance transform rule maps a user attribute to a SAML assertion attribute. Add a rule to issue the AD FS user UPN as
NameID. -
In the Add Transform Claim Rule Wizard, set Claim rule template to Transform an Incoming Claim, and then click Next.
-
Configure the claim information.

-
Enter a custom claim rule name.
-
In the Incoming claim type drop-down list, select UPN.
-
In the Outgoing claim type drop-down list, select Name ID.
-
In the Outgoing name ID format drop-down list, select Email.
-
Select Pass through all claim values.
-
Click Finish.
-
-
Click OK.
Step 4: Obtain the IdP metadata from AD FS
On the AD FS server, access the following URL to download the IdP metadata file: https://<ADFS-server>/federationmetadata/2007-06/federationmetadata.xml.
Replace <ADFS-server> with the domain name or IP address of the AD FS server.
Step 5: Enable SSO in CloudSSO
-
In the left-side navigation pane of the CloudSSO console, click Settings.
-
In the SSO Login section, click Configure IdP Information.
-
In the Configure IdP Information dialog box, select Upload Metadata File.
-
Click Upload File to upload the IdP metadata file obtained in Step 4: Obtain the IdP metadata from AD FS.
NoteIf the metadata file exceeds the size limit, try removing all content within
<fed:ClaimTypesRequested>and<fed:ClaimTypesOffered>. -
Turn on SSO.
ImportantAfter you enable SSO, username-and-password logon is automatically disabled for all CloudSSO users. This is a global setting — once enabled, all users must authenticate through SSO.
Verify the configuration
You can initiate SSO from either Alibaba Cloud or AD FS.
-
Initiate SSO from Alibaba Cloud
-
On the Overview page of the CloudSSO console, copy the user portal URL.
-
Open the URL in a new browser window.
-
Click Redirect to go to the AD FS logon page.

-
Enter the username and password of an AD user.
You are automatically signed in to the CloudSSO user portal.
-
On the Logon as RAM Role tab, click Show Details in the Permissions column for the target resource directory account.

-
In the permissions panel, click Log On in the Actions column for the target permission.
-
Access your authorized resources in the member account.
-
-
Initiate SSO from AD FS
-
Go to the AD FS SSO portal.
The SSO portal URL is
https://<ADFS-server>/adfs/ls/IdpInitiatedSignOn.aspx.Note-
Replace <ADFS-server> with the domain name or IP address of the AD FS server.
-
If the SSO portal page is unavailable, run the following PowerShell command to enable it:
Set-AdfsProperties -EnableIdpInitiatedSignonPage $True.
-
-
Select the CloudSSODemo site created in Step 2: Add Alibaba Cloud as a relying party in AD FS, and then click Sign in.
-
Enter the username and password of an AD user, and then click Sign in.
You are automatically signed in to the CloudSSO user portal.
-
On the Logon as RAM Role tab, click Show Details in the Permissions column for the target resource directory account.

-
In the permissions panel, click Log On in the Actions column for the target permission.
-
Access your authorized resources in the member account.
-