If I am using AWS CLI commands ("aws"), it works to have it pick up the profile I'm using if I set the environment variable AWS_PROFILE so that I don't have to specify credentials or region for each command. This does not work for the AWS Powershell commands. I have to use -ProfileName to get those to work. Can anyone tell how to make this work so that I don't have to specify profile related stuff in each command line?
Asked
Active
Viewed 243 times
0
-
I have discovered that if I copy the section for the profile that I want to use to a [default] section in the ~\.aws\credentials file, then Powershell commands will work without specifying anything. But, there does not appear to be any way for that to be done except for me to manipulate that file myself. And it applies to all sessions of Powershell, unlike if it was using a per session environment variable. – Roman Dec 08 '22 at 04:33
1 Answers
1
AWS Tools for PowerShell does not support AWS_PROFILE
- https://github.com/aws/aws-tools-for-powershell/issues/8
You can specify the profile to use for a PowerShell session via Set-AWSCredential:
Set-AWSCredential -ProfileName MyProfileName
See Specifying Credentials in the AWS Tools for PowerShell user guide for more.

ashovlin
- 106
- 5