Connect to AWS CLI via Powershell

In this tutorial, you can connect your Powershell terminal to AWS CLI using SAML2AWS.

Especially handy for AWS tenancies utilising MFA authentication.



  1. Launch elevated Powershell.
  2. Execute CMDLET Set-ExecutionPolicy Bypass -Scope Process.
  3. Download and save Chocolatey installation script.
  4. Install Chocolatey by executing installation script using CMDLET .\install.ps1. Wait for it to complete.
  5. Install SAML2AWS using command choco install saml2aws.
  6. 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}
  7. Once configured, you will receive the following message: Configuration saved for IDP account: default.
  8. 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.
  9. (Optional) Enter your MFA token code for Security Token [000000] and hit Enter.
  10. Please choose the role – Select the AWS account you wish to login to.

Congratulations! You have successfully logged in to AWS CLI.