Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STS:AssumeRole Error after deployment #25

Open
KWS-Blackout opened this issue Mar 10, 2023 · 7 comments
Open

STS:AssumeRole Error after deployment #25

KWS-Blackout opened this issue Mar 10, 2023 · 7 comments

Comments

@KWS-Blackout
Copy link

Running into the following error after deploying cloudformation for password rotation.

6858314d-cee5-4cf8-abfd-392603586515 Check that AccountID: [AccountID] has the correct IAM Role deployed to it via the CloudFormation Stack Template. Raw Error: An error occurred (AccessDenied) when calling the AssumeRole operation: User: arn:aws:sts::AccountID:assumed-role/asa-iam-key-rotation-account-inventory-lambda-execution-role/ASA-Account-Inventory is not authorized to perform: sts:AssumeRole on resource: arn:aws:iam::AccountID:role/asa-iam-key-rotation-list-accounts-role

policy has assume role for specified role in error.

{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": "lambda:InvokeFunction",
"Resource": "*"
},
{
"Sid": "VisualEditor1",
"Effect": "Allow",
"Action": "sts:AssumeRole",
"Resource": "arn:aws:iam::AccountID:role/asa-iam-key-rotation-list-accounts-role"
}
]
}

@Pheels
Copy link

Pheels commented Apr 7, 2023

I also ran into this issue - in order to fix you need to add the following permission to asa-iam-key-rotation-lambda-execution-role in your main deployment account:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "PermissionToAssumeRoles",
            "Effect": "Allow",
            "Action": "sts:AssumeRole",
            "Resource": [
                "arn:aws:iam::${AccountA}:role/asa-iam-key-rotation-lambda-assumed-role",
                "arn:aws:iam::${AccountB}:role/asa-iam-key-rotation-lambda-assumed-role"
            ]
        }
    ]
}

@denn0muk
Copy link

A poorly documented solution from AWS. Have to figure out stuff to get it working

@botscholar-scott
Copy link

I'm running into this same error but for the main deployment account (just doing manual tests at this point). I added our account id to this new policy @Pheels pasted above that we attached to the asa-iam-key-rotation-lambda-execution-role to no avail.

@botscholar-scott
Copy link

But in our case we don't have the asa-iam-key-rotation-lambda-assumed-role that we are trying to assume on the main deployment account so perhaps there's an earlier step that doesn't make this role on the main account?

@botscholar-scott
Copy link

I missed the third bullet of 6.1,
"If deployed via organizations, the root org account will not be included."

@DNascimento99
Copy link

Has anyone managed to fix this problem?

@nicocayetano
Copy link

In our experience, the issue is not the IAM permission but the lambda function is performing an assume role on an invalid role arn: "arn:aws:iam:::role/asa-iam-key-rotation-list-accounts-role"
error message:
An error occurred (AccessDenied) when calling the AssumeRole operation: User: arn:aws:sts::AccountID:assumed-role/asa-iam-key-rotation-account-inventory-lambda-execution-role/ASA-Account-Inventory is not authorized to perform: sts:AssumeRole on resource: arn:aws:iam:::role/asa-iam-key-rotation-list-accounts-role

It is missing the Account ID hence it is failing. I added aws_account_id='<deployment_account_id>' and the AssumeRole request on the role went through and it started to assume other roles from other accounts. however still having issues with the other functions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants