In this tutorial, you can connect your Powershell terminal to AWS CLI using SAML2AWS.
Especially handy for AWS tenancies utilising MFA authentication.
Pre-requisites
- Powershell 5.1
- Chocolatey
- SAML2AWS
Instructions
- Launch elevated Powershell.
- Execute CMDLET Set-ExecutionPolicy Bypass -Scope Process.
- Download and save Chocolatey installation script.
- Install Chocolatey by executing installation script using CMDLET .\install.ps1. Wait for it to complete.
- Install SAML2AWS using command choco install saml2aws.
- Configure SAML2AWS for your AWS tenancy using command saml2aws configure.
Please choose a provider: ADFS (Optional)Please choose an MFA: {MFA Token Provider} AWS Profile: saml URL: https://<Server Name>/adfs/ls/idpinitiatedsignon.aspx Username: {Domain}\{Username} Password: {DomainPassword} Confirm: {DomainPassword}
- Once configured, you will receive the following message: Configuration saved for IDP account: default.
- Now, execute the command saml2aws login this will now attempt to login to your AWS tenancy using above details. You may be prompted for username, password and Security Token.
- (Optional) Enter your MFA token code for Security Token [000000] and hit Enter.
- Please choose the role – Select the AWS account you wish to login to.
Congratulations! You have successfully logged in to AWS CLI.