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

aws configure export-credentials format powershell add extra quotes for AWS_SESSION_TOKEN= #8284

Closed
rupaks opened this issue Nov 1, 2023 · 5 comments
Assignees
Labels
bug This issue is a bug. credential-provider p2 This is a standard priority issue response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@rupaks
Copy link

rupaks commented Nov 1, 2023

Describe the bug

  1. run aws configure export-credentials --profile my-profile --format powershell
  2. observe AWS_SESSION_TOKEN having extra " like: $Env:AWS_SESSION_TOKEN=""g==""

Expected Behavior

aws configure export-credentials --profile my-profile --format powershell should export AWS_SESSION_TOKEN as $Env:AWS_SESSION_TOKEN="g==" -- without any extra double quotes

Current Behavior

  1. run aws configure export-credentials --profile my-profile --format powershell
  2. observe AWS_SESSION_TOKEN having extra " like below: $Env:AWS_SESSION_TOKEN=""g==""

Reproduction Steps

  1. run aws configure export-credentials --profile my-profile --format powershell
  2. observe AWS_SESSION_TOKEN having extra " like below: $Env:AWS_SESSION_TOKEN=""g==""

Possible Solution

No response

Additional Information/Context

No response

CLI version used

aws-cli/2.13.30 Python/3.11.6 Windows/10 exe/AMD64 prompt/off

Environment details (OS name and version, etc.)

Windows 10

@rupaks rupaks added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Nov 1, 2023
@RyanFitzSimmonsAK RyanFitzSimmonsAK self-assigned this Nov 2, 2023
@RyanFitzSimmonsAK RyanFitzSimmonsAK added credential-provider p2 This is a standard priority issue and removed needs-triage This issue or PR still needs to be triaged. labels Nov 2, 2023
@RyanFitzSimmonsAK
Copy link
Contributor

Hi @rupaks, thanks for reaching out. I had some trouble reproducing this behavior in both Powershell and Command Prompt. What shell are you using? Does this occur every time, even if you log out of SSO and log back in?

@RyanFitzSimmonsAK RyanFitzSimmonsAK added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Nov 2, 2023
@rupaks
Copy link
Author

rupaks commented Nov 6, 2023

Hi @RyanFitzSimmonsAK , thanks for checking !!

I can still reproduce.

my aws config looks like below:

[my-aws-profile]
aws_access_key_id=ABCXYZABCXYZ
aws_secret_access_key=abcxyzabcxyz
aws_session_token="abcxyzabcxyz=="
aws_expiration=2023-11-01T22:09:01.000Z

when I run below:

aws configure export-credentials --profile my-aws-profile --format powershell

notice the output for AWS_SESSION_TOKEN, there are extra "":

$Env:AWS_ACCESS_KEY_ID="ABCXYZABCXYZ"
$Env:AWS_SECRET_ACCESS_KEY="abcxyzabcxyz"
$Env:AWS_SESSION_TOKEN=""abcxyzabcxyz==""

PowerShell version I am using:

Name                           Value
----                           -----
PSVersion                      7.3.8
PSEdition                      Core
GitCommitId                    7.3.8
OS                             Microsoft Windows 10.0.19045
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

@RyanFitzSimmonsAK
Copy link
Contributor

Hey @rupaks, thanks for your patience. I just realized you have quotes around the session token in your configuration file. That is likely the source of the issue. From the short-term credentials documentation, it doesn't look like those quotes should be there. Let me know if that helps.

@rupaks
Copy link
Author

rupaks commented Nov 30, 2023

@RyanFitzSimmonsAK thanks for pointing out...
finally traced it to NPM package aws-azure-login we use for authentication.
when we run $ aws-azure-login --profile my-profile , It adds those quotes to aws_session_token

So looks like a bug for aws-azure-login

@rupaks rupaks closed this as completed Nov 30, 2023
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. credential-provider p2 This is a standard priority issue response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

2 participants