MFA serial in credentials is being ignored
See original GitHub issueWhen I define mfa_serial in the source_profile or in the credentials file, AWS Toolkit would not ask me for a MFA token which causes an “access denied” error.
Here is a config that works because I defined mfa_serial directly in the profile: ~/.aws/config:
[default]
region = eu-central-1
[profile foo]
role_arn = arn:aws:iam::***:role/AdminRole
mfa_serial = arn:aws:iam::***:mfa/foo
source_profile = default
~/.aws/credentials:
[default]
aws_access_key_id = asdf
aws_secret_access_key = asdf
Here is a config that does not work because I defined mfa_serial in the source_profile: ~/.aws/config:
[default]
region = eu-central-1
mfa_serial = arn:aws:iam::***:mfa/foo
[profile foo]
role_arn = arn:aws:iam::***:role/AdminRole
source_profile = default
~/.aws/credentials:
[default]
aws_access_key_id = asdf
aws_secret_access_key = asdf
Here is a config that does not work because I defined mfa_serial in the credentials file: ~/.aws/config:
[default]
region = eu-central-1
[profile foo]
role_arn = arn:aws:iam::***:role/AdminRole
source_profile = default
~/.aws/credentials:
[default]
aws_access_key_id = asdf
aws_secret_access_key = asdf
role_arn = arn:aws:iam::***:role/AdminRole
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (7 by maintainers)
Top Results From Across the Web
Assume role asks for MFA even with valid credentials #5880
I'm trying to setup temporary credentials for my local machine using the assume role approach on AWS CLI. For this, I have two...
Read more >Resynchronizing virtual and hardware MFA devices
In the navigation pane, choose Users, and then choose the name of the user whose MFA device needs to be resynchronized. Choose the...
Read more >Boto3 AWS MFA authentication fails when run on Mac Native ...
This explains the unexpected extra request for MFA - the user values from my script were simply being ignored and the session credentials...
Read more >Enabling a hardware TOTP token (console) - 亚马逊云科技
On the Amazon IAM credentials tab, in the Multi-factor authentication (MFA) section, choose Assign MFA device. In the wizard, type a Device name,...
Read more >Multi-factor Authentication (MFA) for AWS CLI - Redpill Linpro
The following credentials are meant to belong to the same physical user. Account ACME. IAM user: bob; AWS AccountID: 12345NAN1234; Access key: ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

We have not yet merged the fix, so would like to keep this open.
@odbaeu We currently have a PR #1766 that should resolve this issue. MFA serials are now lifted out of source profiles into the child profile for role assumption. I tested one of your non-working configurations and it works correctly for me.
To confirm the fix works for all your potential use cases, it would be helpful you can try out the pre-release build: