aws/aws-tools-for-powershell

Initialize-AWSDefaultConfiguration -ProfileLocation not working

mthmi opened this issue · 3 comments

mthmi commented

Describe the bug

When using Initialize-AWSDefaultConfiguration to initialize AWS credentials in powershell I specify the command as:
Initialize-AWSDefaultConfiguration -ProfileName "org" -Region "us-east-1" and this will work when running Powershell as the user that holds the credentials file in their user profile.
However when I am running PowerShell as a different user than the one logged into the computer I need to specify where the credentials file is located, in the other users profile, and it is not working when using command:
Initialize-AWSDefaultConfiguration -ProfileName "org" -Region "us-east-1" -ProfileLocation "c:\users\USERNAME\.aws\credentials"
When calling the module it prompts for the AWS Access Key instead of reading the credentials file where it is stored.

Expected Behavior

Read credentials from the specified credentials file in the location -ProfileLocation.

Current Behavior

Prompting for AWS Access Key and Secret Access Key at console instead of reading them from the file.

Reproduction Steps

Run the command Initialize-AWSDefaultConfiguration -ProfileName "org" -Region "us-east-1" -ProfileLocation "c:\users\USERNAME\.aws\credentials" while running PowerShell as a different user than the one with the credentials file in their profile.

Possible Solution

No response

Additional Information/Context

No response

AWS Tools for PowerShell version used

AWSPowerShell 4.1.315

PowerShell version used

Name Value


PSVersion 5.1.19041.2673
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.2673
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Operating System and version

Windows 10

Hi @mthmi,

Good afternoon.

Could you please confirm if you have Administrator access on the machine? If not, could you access the other user's profile directory and open the credentials file. My assumption is that if you do not have Administrator access (or privileged access), you would not be able to access any file in other user's profile directory. You could check this my accessing and opening the credentials file directly in notepad and check if you have access.

You could also execute CmdLet with -Verbose flag parameter to see the detailed logging.

Thanks,
Ashish

mthmi commented

You are correct, the user did not have permissions to read the profile of the other user. After correcting permissions it works as expected.

⚠️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.