I'm working on an unattended PowerShell script and want to store AWS credentials the Right Way.
According to the documentation, I should be able to store credentials in a .ini file like this
.\myAWSCredentials.ini
[default]
aws_access_key_id = XXXXXXXXXXXXXXX
aws_secret_access_key = YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
[namedProfile]
aws_access_key_id = XXXXXXXXXXXXXXX
aws_secret_access_key = YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
and load it into my environment with
Set-AWSCredentials -ProfilesLocation .\myAWSCredentials.ini
or
Set-AWSCredentials -ProfileName namedProfile -ProfilesLocation .\myAWSCredentials.ini
But I get an error that doesn't make sense— what does PowerShell have to do with an App.config file?
Set-AWSCredentials : Error loading stored credentials, (profile location = '.\myAWSCredentials.ini'). Error: App.config does not contain credentials information. Either add the AWSAccessKey and AWSSecretKey or AWSProfileName. At line:1 char:1 + Set-AWSCredentials -ProfilesLocation .\myAWSCredentials.ini + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Set-AWSCredentials], ArgumentException + FullyQualifiedErrorId : System.ArgumentException,Amazon.PowerShell.Common.SetCredentialsCmdlet