MFA and Identity Provider Federation

5 minutes 5 Questions

Multi-Factor Authentication (MFA) adds a second verification factor beyond a password. It combines something you know with something you have or something you are. In AWS, MFA can be enabled for the root user and IAM users with virtual authenticator apps, FIDO2 passkeys or security keys, and hardware TOTP tokens. IAM Identity Center can also enforce MFA for workforce users. For the exam, know how to require MFA through IAM policy condition keys. The key aws:MultiFactorAuthPresent can deny sensitive actions, such as deleting resources or modifying IAM, unless the session was MFA-authenticated. The key aws:MultiFactorAuthAge limits how long ago that authentication occurred. MFA Delete on versioned S3 buckets protects against accidental or malicious deletion of object versions, and only the root user can enable it. With the AWS CLI, users call sts:GetSessionToken with their MFA device serial number and token code to obtain temporary credentials. Foundational best practices include protecting the root user with MFA and avoiding root access keys. AWS Organizations also supports centralized root access management. Identity Provider Federation lets users authenticate with an external identity system and receive temporary AWS credentials instead of long-term IAM user keys. SAML 2.0 federation integrates corporate directories such as Active Directory through AD FS, Okta, or Microsoft Entra ID. The identity provider issues a signed assertion, and STS AssumeRoleWithSAML returns short-lived credentials mapped to IAM roles. OIDC federation supports web identities and workloads, such as GitHub Actions or EKS service accounts, through AssumeRoleWithWebIdentity. Amazon Cognito identity pools broker AWS access for mobile and web application users. IAM Identity Center is the recommended approach for multi-account workforce access, using permission sets and SCIM provisioning. Key exam topics include role trust policies that check audience and subject claims, session duration limits, and session tags for attribute-based access control (ABAC). You should also know how CloudTrail logs federated identities. Federation centralizes the identity lifecycle, reduces credential sprawl, and lets organizations enforce MFA at the identity provider.

MFA and Identity Provider Federation for the AWS Certified Security Specialty Exam

Introduction
Multi-Factor Authentication (MFA) and Identity Provider (IdP) Federation sit at the heart of the Identity and Access Management domain of the AWS Certified Security – Specialty exam. Together they answer two key questions: How do we prove a user is who they claim to be? and How do we let users from an external identity system reach AWS resources safely, while avoiding long-term credentials? This guide explains why these topics matter, what they are, how they work in AWS, and how to approach exam questions about them.

Why MFA and Identity Federation Are Important
1. Credential theft is the most common attack vector. Passwords and access keys get phished, leaked in code repositories, or reused across sites. MFA adds a second factor (something you have or something you are), so a stolen password alone is not enough.
2. Long-term credentials are a liability. IAM users with static access keys must be rotated, tracked and protected. Federation replaces them with temporary credentials issued by AWS STS that expire on their own.
3. Centralized identity lifecycle. With federation, joiners, movers and leavers are managed in one place (for example Microsoft Entra ID, Okta, Active Directory). When an employee is disabled in the corporate IdP, their AWS access ends as well.
4. Compliance and auditing. Frameworks such as PCI DSS, HIPAA, SOC 2 and CIS AWS Foundations Benchmark require MFA for privileged access and favor centralized identity. CloudTrail records federated sessions, including the source identity and role session name.
5. Scale. Organizations with many accounts in AWS Organizations cannot practically maintain IAM users in each account. IAM Identity Center and SAML federation provide one sign-in for all accounts.

What Is MFA in AWS?
MFA requires a user to present a second factor in addition to a password or access key. AWS supports the following MFA device types for IAM users and the root user:
• Passkeys and FIDO2 security keys (for example YubiKey, built-in biometric authenticators) – phishing-resistant, based on public-key cryptography.
• Virtual authenticator apps (for example Google Authenticator, Microsoft Authenticator, Authy) – generate time-based one-time passwords (TOTP).
• Hardware TOTP tokens – physical devices that display a rotating six-digit code.

Key facts about MFA in AWS:
• Up to eight MFA devices of any combination can be registered for the root user and each IAM user.
• MFA is mandatory for root users in many account types under current AWS policy, and should always be enabled on the root user as a best practice.
• For accounts in AWS Organizations, centralized root access management lets you remove root credentials from member accounts entirely and perform privileged root tasks from the management account.
• FIDO2 security keys cannot be used with the AWS CLI/API to satisfy MFA via STS GetSessionToken; TOTP devices (virtual or hardware) are required for CLI-based MFA calls.
• IAM Identity Center has its own MFA settings (always-on or context-aware, authenticator apps, security keys/built-in authenticators). When an external IdP is used, MFA is normally enforced in that IdP.
• Amazon Cognito user pools support SMS, TOTP and email-based MFA, plus adaptive authentication in the advanced security features.

How MFA Is Enforced in AWS
1. IAM policy condition keys
• aws:MultiFactorAuthPresent – Boolean that is true when the request was authenticated with MFA.
• aws:MultiFactorAuthAge – Number of seconds since MFA authentication, used to require recent MFA (for example, within the last hour).

Important nuance: When a request is signed with long-term IAM user access keys, the aws:MultiFactorAuthPresent key is not present at all in the request context. That is why the recommended deny pattern is:
Effect: Deny, Condition: BoolIfExists { aws:MultiFactorAuthPresent: false }
Using BoolIfExists ensures that requests lacking the key (long-term keys) are also denied. A plain Bool check of false would not match a missing key, letting access-key requests slip through. Conversely, an Allow statement should use Bool { aws:MultiFactorAuthPresent: true }.

2. MFA-protected API access with STS
Users of the CLI or SDK call sts:GetSessionToken (or sts:AssumeRole) and pass SerialNumber and TokenCode. The temporary credentials returned carry the MFA context, so policies requiring MFA are satisfied. A common pattern is a role trust policy requiring MFA, so that sensitive roles can only be assumed after MFA.

3. The classic self-service MFA policy
AWS publishes a policy that lets IAM users manage their own password and MFA device, while denying all other actions until they sign in with MFA (using NotAction plus BoolIfExists). Expect exam scenarios based on this pattern.

4. Amazon S3 MFA Delete
When enabled on a versioned bucket, MFA Delete requires MFA to permanently delete an object version or to change the versioning state. Key facts: it can only be enabled by the root user of the bucket owner account, only through the CLI/API (not the console), and it requires versioning to be enabled.

5. Service Control Policies
SCPs in AWS Organizations can deny sensitive actions across accounts unless MFA is present, acting as a guardrail regardless of identity-based permissions.

What Is Identity Provider Federation?
Federation is a trust relationship between AWS and an external identity provider. Users authenticate with the external IdP, which issues an assertion or token. AWS STS validates it and returns temporary security credentials tied to an IAM role. No IAM users are created for the federated identities.

Federation Options in AWS
1. SAML 2.0 federation (IAM)
• Used for workforce identities with corporate IdPs such as Active Directory Federation Services (AD FS), Okta, Ping or Microsoft Entra ID.
• You create a SAML identity provider in IAM by uploading the IdP metadata document, then create roles whose trust policy allows sts:AssumeRoleWithSAML from that provider.
• Flow: user signs in to IdP → IdP authenticates (often with MFA) and generates a SAML assertion including role ARN and provider ARN attributes → browser posts the assertion to the AWS sign-in endpoint (https://signin.aws.amazon.com/saml) → STS returns temporary credentials → user lands in the console.
• Trust policy conditions often check SAML:aud, and attributes such as saml:sub or session tags passed via PrincipalTag attributes.

2. OpenID Connect (OIDC) / web identity federation
• Used for mobile/web apps and for workloads such as GitHub Actions, GitLab, Kubernetes service accounts (IRSA), Google, or any OIDC-compatible provider.
• You create an OIDC identity provider in IAM with the issuer URL and audience (client ID). Roles trust it via sts:AssumeRoleWithWebIdentity.
• Always restrict the trust policy with conditions on aud and sub (for example token.actions.githubusercontent.com:sub limited to a specific repository and branch). A missing sub condition is a classic misconfiguration that would let any repository assume the role.
• For customer-facing mobile apps, AWS recommends Amazon Cognito rather than calling AssumeRoleWithWebIdentity from the app.

3. AWS IAM Identity Center (successor to AWS SSO)
• The recommended approach for workforce access to multiple AWS accounts in AWS Organizations.
• Identity sources: Identity Center directory, Active Directory (AWS Managed Microsoft AD or AD Connector), or an external IdP via SAML 2.0 with SCIM for automatic user and group provisioning.
• Access is granted through permission sets, which Identity Center provisions as IAM roles (named AWSReservedSSO_...) in each assigned account.
• Supports attributes for access control (ABAC) and integrates with many SaaS applications.

4. Amazon Cognito
• User pools are user directories providing sign-up/sign-in, MFA and federation with social IdPs (Google, Facebook, Apple, Amazon) and enterprise SAML/OIDC IdPs. They issue JWTs (ID, access and refresh tokens).
• Identity pools (federated identities) exchange tokens from user pools or other IdPs for temporary AWS credentials, mapping users to authenticated or unauthenticated (guest) IAM roles. Role-based access and attribute mapping enable fine-grained permissions.

5. Custom identity broker
• For IdPs that support neither SAML nor OIDC. A broker application authenticates users against the corporate store, then calls sts:AssumeRole or sts:GetFederationToken and, if needed, constructs a sign-in URL via the federation endpoint for console access.
• This is the most effort to build and secure, so it is rarely the best exam answer unless the scenario explicitly rules out SAML/OIDC.

6. IAM Roles Anywhere
• Lets on-premises servers and workloads outside AWS obtain temporary credentials using X.509 certificates issued by a trusted certificate authority (for example AWS Private CA). It replaces long-term access keys for hybrid workloads.

Key STS Concepts to Know
• AssumeRole – cross-account or same-account role assumption; supports MFA (SerialNumber, TokenCode) and ExternalId for third-party access (confused deputy protection).
• AssumeRoleWithSAML – SAML federation; no AWS credentials needed to call it.
• AssumeRoleWithWebIdentity – OIDC federation; no AWS credentials needed to call it.
• GetSessionToken – temporary credentials for an IAM user, typically to add MFA context.
• GetFederationToken – used by custom brokers; credentials are limited by the intersection of the calling user's permissions and the passed session policy.
• Session policies passed at assume time can only reduce, never expand, permissions.
• Session tags and source identity carry user attributes into the session for ABAC and auditing; sts:SetSourceIdentity persists across role chaining and appears in CloudTrail.
• Maximum session duration for a role is 1 to 12 hours; role chaining limits sessions to 1 hour.
• Temporary credentials cannot be revoked individually, but you can use the IAM console's Revoke active sessions feature, which attaches a deny policy using aws:TokenIssueTime to block sessions issued before a given time.

Troubleshooting Federation Issues
• Access denied on AssumeRoleWithSAML: check the role trust policy (correct provider ARN and SAML:aud), and confirm the assertion includes the Role attribute in the format role ARN, provider ARN.
• Expired or invalid SAML assertion: verify clock synchronization on the IdP and that the IdP signing certificate in IAM matches the current one (update metadata after certificate rotation).
• OIDC errors: check the issuer URL, audience/client ID, and thumbprint (where applicable) configured on the IAM OIDC provider, along with sub conditions.
• Users cannot see accounts in Identity Center: check permission set assignments, group membership synced through SCIM, and the configured identity source.
• MFA condition not working for CLI users: they are likely using long-term keys; require GetSessionToken with MFA and use BoolIfExists in deny statements.
• Use CloudTrail events (AssumeRoleWithSAML, AssumeRoleWithWebIdentity, ConsoleLogin with MFAUsed field) to investigate.

Exam Tips: Answering Questions on MFA and Identity Provider Federation
1. Favor temporary credentials over long-term ones. If an answer option involves creating IAM users with access keys for employees, partners or applications that could use federation or roles, it is almost always wrong.
2. Match the scenario to the right federation service:
• Many AWS accounts + corporate workforce → IAM Identity Center (with external IdP or AD as identity source).
• Single account + existing SAML IdP → IAM SAML identity provider with AssumeRoleWithSAML.
• Mobile/web app customers, social logins → Amazon Cognito (user pools for authentication, identity pools for AWS credentials).
• CI/CD pipelines such as GitHub Actions → IAM OIDC provider with tightly scoped sub/aud conditions.
• EKS pods → IRSA or EKS Pod Identity.
• On-premises servers needing AWS API access → IAM Roles Anywhere.
• IdP supports neither SAML nor OIDC → custom identity broker.
3. Watch for BoolIfExists versus Bool. When the question asks how to deny actions unless MFA is used, including for access-key callers, the correct choice uses BoolIfExists aws:MultiFactorAuthPresent false in a Deny statement.
4. Require recent MFA with aws:MultiFactorAuthAge. If a scenario says MFA must have occurred within a time window, look for a NumericGreaterThan or NumericLessThan condition on this key.
5. Remember the S3 MFA Delete constraints: root user only, CLI/API only, versioning required.
6. Enforce MFA where authentication happens. With federation, MFA is typically enforced in the external IdP (or in Identity Center for its own directory). An option that adds IAM MFA devices for federated users is a distractor.
7. Least privilege in trust policies. For OIDC and SAML roles, correct answers restrict who can assume the role through conditions (aud, sub, SAML:aud, specific repository or group). Options that trust an entire provider with no conditions are insecure.
8. Confused deputy and third parties. If a vendor needs cross-account access, the answer is a role with an ExternalId condition, not shared access keys.
9. Revocation scenarios. If credentials from a role were compromised, the answer is to revoke active sessions (deny on aws:TokenIssueTime), then investigate with CloudTrail; deleting the role is usually too disruptive unless stated otherwise.
10. Automatic provisioning. When a question mentions keeping users and groups in sync between a corporate IdP and AWS, look for SCIM with IAM Identity Center.
11. Read for the least operational overhead. Managed services (Identity Center, Cognito, Roles Anywhere) usually beat custom code such as brokers or Lambda-based token exchange.
12. Root account protection. Questions about securing the root user point to enabling MFA (preferably phishing-resistant FIDO2 keys), removing root access keys, and using centralized root access management in Organizations.
13. Know the CLI limitation. FIDO2 security keys work for console sign-in, but CLI MFA via GetSessionToken or AssumeRole requires a TOTP device.
14. Eliminate distractors by keywords. Terms like embed access keys in the app, share credentials, or create an IAM user per customer signal wrong answers. Terms like temporary credentials, role, trust policy condition, and centralized identity signal strong answers.

Summary
MFA strengthens authentication by requiring a second factor, and AWS enforces it through device registration, IAM condition keys, STS MFA parameters, S3 MFA Delete and SCPs. Identity Provider Federation removes the need for long-term AWS credentials by trusting external IdPs through SAML 2.0, OIDC, IAM Identity Center, Cognito, custom brokers or IAM Roles Anywhere, all of which result in temporary STS credentials tied to IAM roles. On the exam, identify who needs access, where they authenticate, and how many accounts are involved, then choose the managed, least-privilege, temporary-credential solution with properly scoped trust policies and correctly written MFA conditions.
Test mode:
More MFA and Identity Provider Federation questions
23 questions (total)