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

The powershell script fails if repeated 2 times or more #72

Open
MarcSamD opened this issue Oct 11, 2022 · 1 comment
Open

The powershell script fails if repeated 2 times or more #72

MarcSamD opened this issue Oct 11, 2022 · 1 comment

Comments

@MarcSamD
Copy link
Contributor

On my case, the script only works when launch the first time. Then there is an authentication issue and it cannot creates new keys (nor do anything in AWS in fact).

I found after the script is run a first time, 2 profiles "default" exist and can be displayed with the command Get-AWSCredentials -ListProfileDetail:

ProfileName StoreTypeName         ProfileLocation
----------- -------------         ---------------
default     NetSDKCredentialsFile
default     SharedCredentialsFile C:\Users\username\.aws\credentials

I suspect that somehow, when the script updates the profiles, it succeeds for the SharedCredentialsFile but it fails for the NetSDKCredentialsFile. Manually removing the NetSDKCredentialsFile with the command Remove-AWSCredentialProfile -ProfileName default is a workaround to make the script work again once.

@MarcSamD
Copy link
Contributor Author

A (dirty?) way to fix this issue is to comment the line Set-AWSCredential -StoreAs $profile -AccessKey $new_key.AccessKeyId -SecretKey $new_key.SecretAccessKey in the script to only keep the 1st one that update the ProfileLocation (so the SharedCredentialsFile).

I'm not sure what this 2nd line is for (updating SDK credentials ?) and it seems other people are not complaining about so I don't create a PR for this. But I see 2 reasons that it could be linked to: either MFA setup or usage on a non standard region (I'm on China region). The issue #65 could also be caused by that as I had very similar authentication error message.

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

1 participant