aws / aws-tools-for-powershell

The AWS Tools for PowerShell lets developers and administrators manage their AWS services from the PowerShell scripting environment.
Apache License 2.0
235 stars 78 forks source link

Prompting to enter MFA every single time #219

Closed kbyunAncile closed 3 years ago

kbyunAncile commented 3 years ago

The Question

I have configured MFA for my named profile. When I use aws cli, it prompts MFA authentication for the first time. Then it caches it for certain duration or when new profile is detected.
But for Powershell aws-tool always prompts MFA authentication every time script runs.

for example, if I have a powershell script

Write-Host "aws cli call"
aws s3 ls
Write-Host "Powershell AWS-Tool Call"
Get-S3Bucket

for first execution, both calls will ask MFA. But on second execution only Powershell AWS-Tool will ask MFA. I wonder if there is a configuration for MFA sessions.

Or maybe it is related to how I'm configuring profile? for AWS CLI, I set environment variable $env:AWS_PROFILE="myprofile" to desired profile for Powershell AWS-Tool, I call Set-AWSCredential -ProfileLocation $env:UserProfile\.aws\config -ProfileName myprofile

Environment

Amazon Web Services SDK for .NET Core Runtime Version 3.3.104.35



---
ashishdhingra commented 3 years ago

Hi @kbyunAncile,

Good morning.

AWS Tools for PowerShell rely on AWS .NET SDK behind the scenes. Kindly refer the guidance provided in https://github.com/aws/aws-sdk-net/issues/1844#issuecomment-831580377.

Thanks, Ashish

github-actions[bot] commented 3 years ago

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.