Skip to content

AWS Assume Role via .Net SDK gives Access Denied but works with CLI #2059

Discussion options

You must be logged in to vote

@mahesh-cognologix Good morning. Your .NET logic to use temporary credentials with assumed role appears to be incorrect. The call to AssumeRole service API operation itself returns the temporary session credentials. But in your code you are executing the AssumeRoleAsync:

await stsClient.AssumeRoleAsync(
                    new AssumeRoleRequest()
                    {
                        RoleArn = roleARN,
                        RoleSessionName = "mySession"
                    });

without consuming the returned credentials. Then you are just constructing new session credentials with no role attached and hence you get Access Denied error while executing .NET code. If your compare you…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@mahesh-cognologix
Comment options

Answer selected by mahesh-cognologix
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
guidance Question that needs advice or information. credentials
2 participants