Skip to content

Commit 7b4814f

Browse files
committed
📖 Improve examples, add PSGallery badge
1 parent 3025a3a commit 7b4814f

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

ReadMe.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# AWS SSO Programmatic Credentials, Programmatically
2+
[![Latest version, PSGallery](https://img.shields.io/powershellgallery/v/vNugglets.AWSSSO.svg?style=flat&logo=powershell&label=Latest%20Version,%20PSGallery)](https://www.powershellgallery.com/packages/vNugglets.AWSSSO) [![PSGallery Downloads](https://img.shields.io/powershellgallery/dt/vNugglets.AWSSSO.svg?style=flat&logo=powershell&label=PSGallery%20Downloads)](https://www.powershellgallery.com/packages/vNugglets.AWSSSO)
3+
24
When credentials are available via the AWS SSO Identity Center ("IDC"), we can [reasonably] easily get AWS credentials for use with the AWS tools that we know and love (SDKs, CLIs, PowerShell modules, etc.).
35

46
Herein is a PowerShell module that simplifies getting accounts, roles, and credentials for some identity (the user).
@@ -10,6 +12,7 @@ Simplify the creation of AWS credentials to SSO accounts/roles that an identity
1012
### Prerequisite Modules
1113
If you don't already have available the two AWS SSO* modules, install them right quick:
1214
```powershell
15+
## pre-req modules
1316
Install-PSResource AWS.Tools.SSO, AWS.Tools.SSOOIDC
1417
```
1518

@@ -54,7 +57,7 @@ new ssooidc token
5457
get sso account list | Foreach-Object
5558
## get the SSO-related roles to which we are entitled in the given AWS account
5659
get sso account role list |
57-
## filter on <whatveer we like> to get just the account/role info for which to get temp creds
60+
## if not filtering on initial "get sso account list" call via Name param, then filter here on <whatveer we like> to get just the account/role info for which to get temp creds
5861
Where-Object rolename matches something | Foreach-Object
5962
## get the temp creds for the given account and role combos
6063
Get-SSORoleCredential
@@ -72,8 +75,7 @@ A mostly realistic example of getting some credentials.
7275
## make a new SSO OIDC token
7376
New-VNAWSSSOOIDCTokenViaDeviceCode -StartUrl https://mycoolstart.awsapps.com/start/ -Verbose
7477
## get account/role info, filter, get cred for role, get AWS temp cred
75-
Get-VNAWSSSOAccountAndRoleInfo |
76-
Where-Object accountname -like my-cool-account-* |
78+
Get-VNAWSSSOAccountAndRoleInfo -Name my-cool-account-* |
7779
Where-Object RoleName -match _myadminrole_ |
7880
New-VNAWSSSORoleTempCredential -Verbose |
7981
## save to the AWS creds file the temp creds for each account/role
@@ -83,7 +85,7 @@ A mostly realistic example of getting some credentials.
8385
And, to see that example as a likely candidate to paste straight into a PowerShell session (one-line format):
8486
```PowerShell
8587
## make a new SSO OIDC token, get account/role info, filter, get cred for role, get AWS temp cred, save to the AWS creds file the temp creds for each account/role
86-
New-VNAWSSSOOIDCTokenViaDeviceCode -StartUrl https://mycoolstart.awsapps.com/start/; Get-VNAWSSSOAccountAndRoleInfo | Where-Object accountname -like my-cool-account-* | Where-Object RoleName -match _myadminrole_ | New-VNAWSSSORoleTempCredential -Verbose | Set-AWSCredential -ProfileLocation (Resolve-Path ~\.aws\credentials)
88+
New-VNAWSSSOOIDCTokenViaDeviceCode -StartUrl https://mycoolstart.awsapps.com/start/; Get-VNAWSSSOAccountAndRoleInfo -Name my-cool-account-* | Where-Object RoleName -match _myadminrole_ | New-VNAWSSSORoleTempCredential -Verbose | Set-AWSCredential -ProfileLocation (Resolve-Path ~\.aws\credentials)
8789
```
8890

8991
## More Coolness 😎
@@ -96,8 +98,7 @@ Get-VNAWSSSOAccountAndRoleInfo
9698
## *poof*!
9799
98100
## get account/role info, filter like all the other PowerShell filtering we already know and love ❣!
99-
Get-VNAWSSSOAccountAndRoleInfo |
100-
Where-Object accountname -like my-cool-account-* |
101+
Get-VNAWSSSOAccountAndRoleInfo -Name my-cool-account-* |
101102
Where-Object RoleName -match _myadminrole_
102103
```
103104

0 commit comments

Comments
 (0)