Skip to content

How do I resolve issues when I use the AWS Management Console to switch IAM roles?

5 minute read
-1

I used the AWS Management Console to try to switch AWS Identity and Access Management (IAM) roles. However, I received the following error: "Invalid information in one or more fields. Check your information or contact your administrator."

Short description

You receive the Invalid information in one or more fields error message because of an incorrectly configured policy. You might also receive their error message when your request doesn't meet the conditions of a trust policy.

Resolution

Configure the AssumeRole permissions for your IAM user or role

To grant a user permissions to switch roles, add the AWS Security Token Service (AWS STS) AssumeRole action to your IAM identity's policy.

Example policy:

{ 
  "Version": "2012-10-17",
  "Statement": {
    "Effect": "Allow",
    "Action": "sts:AssumeRole",
    "Resource": "arn:aws:iam::account_id_number:role/role-name-you-want-to-assume"  
   }
}

Note: Replace the arn:aws:iam::account_id_number:role/role-name-you-want-to assume with the Amazon Resource Name (ARN) of the IAM role.

Check that the IAM role's trust policy includes a principal

Update the trust policy to include a principal. The principal can be an IAM user or role, or an AWS account.

Note: If you add an account as a trusted principal, then all identities in that account can assume the role. However, the identities must have the AssumeRole permission.

For example, IAM user Carlos in Account ID 111222333444 wants to assume the Maria role in Account ID 444555666777.

Account ID 111222333444 is the trusted account, and Account ID 444555666777 is the trusting account. Maria's IAM role has a trust policy that trusts Carlos.

Example trust policy for the IAM role of Maria:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "sts:AssumeRole",
      "Principal": {
        "AWS": "arn:aws:iam::111222333444:user/Carlos"
      },
      "Condition": {}
    }
  ]
}

Carlos must also have an IAM policy to assume the IAM role of Maria in the other account.

Example IAM policy for Carlos to assume the IAM role of Maria:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "sts:AssumeRole",
      "Resource": "arn:aws:iam::444555666777:role/Maria"
    }
  ]
}

To allow all IAM identities in an account to assume the role, use the account root principal.

In the trust policy of Maria's IAM role, replace user/Carlos with root:

"AWS": "arn:aws:iam::111222333444:root"

In the trust policy of Maria's IAM role, you can also use the wildcard (*) so that the user can assume any role in any account:

"Resource": "arn:aws:iam::444555666777:role/\\\*"

The preceding changes allow any IAM user or role in account 111222333444 to assume Maria's IAM role that's in account ID 444555666777. To minimize the number of identities who can assume the role, it's a best practice to specify the ARN of only the IAM user or role that requires access.

For more information, see Update a role trust policy.

Explicit deny from SCPs or an IAM policy

If your account is part of AWS Organizations, then the management account might apply service control policies (SCPs) that restrict role switching. For more information, see Best practices for the management account.

Check if there's an explicit Deny for the AssumeRole action in either the SCP or the IAM policy. If there is an explicit Deny, the deny overrides any Allow permissions, which prevents the role assumption. In the previous example, if there is an explicit Deny, Carlos can't assume Maria's IAM role.

Also, check if the SCPs restrict access based on AWS Regions. AWS STS is a global service, so you must list it in the global service exclusion list.

For more information, see Deny access to AWS based on the requested AWS Region.

Role requires an sts:ExternalId to switch to the IAM role

If the IAM role requires an sts:ExternalId key, then you can use the AWS Management Console to switch roles. Edit the policy to use the AssumeRole action with the sts:ExternalId parameter.

The sts:ExternalId key allows third-party access to AWS resources.

For more information, see Access to AWS accounts owned by third parties.

Check conditions in the IAM role trust policy

Review the conditions that you configured in the trust policy, such as an expiration date or ExternalId requirement. Your request must meet the conditions of the IAM role policy.

For example, if the current date is after the specified date, then the condition is false and the policy can't grant permission to assume the role.

The following policy denies permission to assume the role after May 1, 2016:

{
  "Effect": "Allow",
  "Action": "sts:AssumeRole",
  "Resource": "arn:aws:iam::account_id_number:role/role-name-you-want-to-assume",
  "Condition": {
    "DateLessThan": {
      "aws:CurrentTime": "2016-05-01T12:00:00Z"
    }
  }
}

Make sure your request satisfies all conditions in the trust policy.

Related information

How do I provide IAM users with a link to assume an IAM role?

How do I use IAM to access resources in another AWS account?

What's the difference between an AWS Organizations service control policy and an IAM policy?

2 Comments

You can't switch roles if you sign in as the AWS account root user (the login credentials you used to sign up for AWS in the first place): Switch from a user to an IAM role (console).

This is especially relevant for those following the Getting started with AWS Organizations guide, or anyone just starting to learn AWS and who has just created an AWS account (this is the management account) and tried to create and access another member account.

When you create your initial AWS account, you have created the "management account", and are the root user of that account. There is an assumption that as root, you can do anything. But in this case, you cannot switch roles as the root user if using the AWS UI (a.k.a., "console").

You must create an IAM group (not strictly necessary, but do it), and then create an IAM user and add it to the group, and then create a policy and attach it to the group. Then you need to log out of your account (your management account) and log back into AWS with the IAM user you just created. Note that you need to enable "Console Access" for the IAM user first, which can be done through the IAM interface. Now you should be able to switch roles.

replied a year ago

This sentence:

"The IAM role trust policy defines the principals that can assume the role Verify that the trust policy lists the IAM user's account ID as the trusted principal entity."

is impossible to comprehend unless you already know what it means.

This might make more sense:

"The trust rules for an IAM role (which decide who can use the role) include which principals are allowed to step into ("assume") that role. Check to make sure those trust rules include the account ID of the IAM user as someone who’s trusted to use it."

The example following the original sentence will make more sense in this context.

replied a year ago