One-time setup of a direct IAM federation application with ADFS
This guide describes the one-time setup process for configuring direct IAM federation with ADFS to enable emergency access to Amazon Web Services accounts when IAM Identity Center is unavailable.
Prerequisites
If you plan to configure ADFS with Amazon Managed Microsoft AD, we recommend that you first
configure
Multi-Region replication
Plan your Active Directory group naming convention
Create AD groups using a specific naming pattern that enables automated matching between group names and Amazon IAM roles.
Group naming format: AWS-<AccountNumber>-<RoleName>
For an illustration, see the emergency account in the diagram under How to design emergency role, account, and group mapping . When a user is assigned to this group, they are granted access to the
EmergencyAccess_Role1_RO role in account 123456789012. If a user is associated with multiple groups,
they see a list of available roles by Amazon Web Services account and can choose which role to assume.
Amazon configuration
The complete setup includes configurations in an emergency access account and the workload accounts. For an illustration of the overall setup, see How to design emergency role, account, and group mapping .
Create a SAML identity provider
In the emergency access account, create a SAML identity provider in IAM by following the steps in
Create a SAML identity provider in IAM
https://<yourADFSserverFQDN>/FederationMetadata/2007-06/FederationMetadata.xml
Create emergency access roles
Create emergency access roles
Considerations:
Include all Regions where you operate — select every Region in which you have active workloads to ensure federation remains available during a Regional disruption.
Configure at least one additional Regional endpoint, even if you operate in a single Region — for example, if you operate only in
us-east-1, addus-west-2as a secondary endpoint. You can fail over your IdP to theus-west-2SAML sign-in endpoint and still access yourus-east-1resources, even without any workloads inus-west-2.Enable both the non-regional endpoint and regional endpoints — Although the non-regional endpoint (
https://signin.aws.amazon.com/saml) is highly available, it is hosted in a single Amazon Web Services Region,us-east-1, while regional endpoints (https://<region>.signin.aws.amazon.com/saml) improve resiliency by reducing dependency on a single global endpoint.
Configure trust policy
Refer to One-time setup of a direct IAM federation application in Okta for an example trust policy with multiple sign-in regional endpoints. Replace the sample regional endpoints and SAML provider ARNs with yours.
Configure permissions policies
Refer to One-time setup of a direct IAM federation application in Okta for an example permissions policy that you attach to the emergency access roles.
Configure workload account roles
For the workload account roles, configure a custom trust policy that allows the emergency access roles in the emergency access account to assume them.
Refer to One-time setup of a direct IAM federation application in Okta for an example trust policy, where account
123456789012 is the emergency access account.
Active Directory configuration
The following steps describe how to configure Active Directory and ADFS for emergency access.
Create groups
Create emergency groups in Active Directory according to the naming convention described earlier
(for example, AWS-123456789012-EmergencyAccess_Role1_RO). Assign users to these groups through your existing
provisioning mechanisms.
Create a relying party
ADFS federation requires a relying party configuration. The relying party is Amazon Security Token Service (Amazon STS), which outsources authentication to ADFS as the identity provider.
In the ADFS Management console, use the Action menu and select Add Relying Party Trust. Select Claims aware when adding a relying party.
For federation metadata, enter the Metadata URL from the identity provider metadata info on the IAM console. For example:
https://signin.aws.amazon.com/static/saml/SAMLSPXXXXXX/saml-metadata.xmlSet the display name for the relying party (for example, Amazon Account Access) and then choose Next.
Select who you want to enable to access Amazon. You can select specific groups and define requirements like MFA.
Choose Close on the Finish page to complete the Add Relying Party Trust Wizard. Amazon is now configured as a relying party.
Create claim rules
ADFS uses Claims Rule Language to issue and transform claims between claims providers and relying parties. You need to create four claim rules: NameId, RoleSessionName, Get AD Groups, and Roles for Amazon Access.
Right-click on the relying party and then choose Edit Claim Issuance Policy. Choose Add Rule to add rules.
1. NameId
Select Transform an Incoming Claim and then choose Next.
Use the following settings:
Claim rule name:
NameIdIncoming claim type:
Windows Account NameOutgoing claim type:
Name IDOutgoing name ID format:
Persistent IdentifierPass through all claim values: checked
Choose OK.
2. RoleSessionName
Choose Add Rule.
In the Claim rule template list, select Send LDAP Attributes as Claims.
Use the following settings:
Claim rule name:
RoleSessionNameAttribute store:
Active DirectoryLDAP Attribute:
E-Mail-AddressesOutgoing Claim type:
https://aws.amazon.com/SAML/Attributes/RoleSessionName
Choose OK.
3. Get AD Groups
Choose Add Rule.
In the Claim rule template list, select Send Claims Using a Custom Rule and then choose Next.
For Claim Rule Name, enter
Get AD Groups, and then in Custom rule, enter the following:c:[Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname", Issuer == "AD AUTHORITY"] => add(store = "Active Directory", types = ("http://temp/variable"), query = ";tokenGroups;{0}", param = c.Value);This custom rule uses a script in the claim rule language that retrieves all the groups the authenticated user is a member of and places them into a temporary claim named
http://temp/variable.Note
Ensure there's no trailing whitespace to avoid unexpected results.
4. Role Attributes
Choose Add Rule.
In the Claim rule template list, select Send Claims Using a Custom Rule and then choose Next.
For Claim Rule Name, enter
Roles, and then in Custom rule, enter the following:c:[Type == "http://temp/variable", Value =~ "(?i)^AWS-([\d]{12})"] => issue(Type = "https://aws.amazon.com/SAML/Attributes/Role", Value = RegExReplace(c.Value, "AWS-([\d]{12})-", "arn:aws:iam::$1:saml-provider/<ADFS>,arn:aws:iam::$1:role/"));This custom rule uses regular expressions to transform each of the group memberships of the form
AWS-<Account Number>-<Role Name>into the IAM role ARN and IAM federation provider ARN form that Amazon expects.Note
In the example rule language above,
ADFSrepresents the logical name given to the SAML identity provider in the Amazon identity provider setup. Change this based on the logical name you chose in the IAM console for your identity provider.
Test the configuration
Test that the solution works by authenticating at
https://<yourADFSserverFQDN>/adfs/ls/IdpInitiatedSignOn.aspx. Select the name of the relying party
you created from the dropdown list of the sites.
Update default SAML assertion endpoint in ADFS
Important
When configuring relying party trust in ADFS, the SAML Assertion endpoint defaults to
https://signin.aws.amazon.com/ which is not a global endpoint and is located in us-east-1.
We recommend that you modify the default endpoint to a regional endpoint different from where your IAM Identity Center is configured for resiliency.
For example, if your IAM Identity Center is deployed in us-east-1 and you also operate in us-west-2, change the default
SAML Assertion consumer endpoint to https://us-west-2.signin.aws.amazon.com/saml.
Choose Properties on the relying party trust and go to the Monitoring tab. Clear the checkbox Automatically Update relying party.
Go to the Endpoints tab, select your preferred sign-in endpoint, and choose Edit.
Select the checkbox Set the trusted URL as default. Choose OK and Apply for the setting to take effect.
Note
Most IdPs enable you to keep an application integration deactivated until required. We recommend that you keep the direct IAM federation application deactivated in your IdP until required for emergency access.