az2aws 1.1.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "1.1.2"
2
+ ".": "1.2.0"
3
3
  }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.2.0](https://github.com/kuma0128/az2aws/compare/v1.1.3...v1.2.0) (2026-01-22)
4
+
5
+
6
+ ### Features
7
+
8
+ * Add version flag to CLI command ([#67](https://github.com/kuma0128/az2aws/issues/67)) ([b89290f](https://github.com/kuma0128/az2aws/commit/b89290fe16d554f6a8a1bf09df0194a64d692b55))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * Add default duration of 1 hour if parsing fails ([#70](https://github.com/kuma0128/az2aws/issues/70)) ([337d12c](https://github.com/kuma0128/az2aws/commit/337d12c90ab0eccf4034bd438ecfb2f0ad98db47))
14
+ * Fix SAML assertion decoding to use UTF-8 encoding ([#72](https://github.com/kuma0128/az2aws/issues/72)) ([14e44a7](https://github.com/kuma0128/az2aws/commit/14e44a7ffe19e48177078aa6d87feb7e8ecf0c94))
15
+ * resolve --no-verify-ssl and proxy settings conflict ([#73](https://github.com/kuma0128/az2aws/issues/73)) ([3fd9adf](https://github.com/kuma0128/az2aws/commit/3fd9adf6dd39109bb428b56215200ad1df3752a9))
16
+
17
+ ## [1.1.3](https://github.com/kuma0128/az2aws/compare/v1.1.2...v1.1.3) (2026-01-19)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * snapcraft deploy flow ([#65](https://github.com/kuma0128/az2aws/issues/65)) ([a4a41d7](https://github.com/kuma0128/az2aws/commit/a4a41d79c3142762f3d593796c8bf31b558bb8fe))
23
+
3
24
  ## [1.1.2](https://github.com/kuma0128/az2aws/compare/v1.1.1...v1.1.2) (2026-01-19)
4
25
 
5
26
 
package/README.md CHANGED
@@ -5,13 +5,13 @@
5
5
 
6
6
  # az2aws
7
7
 
8
- If your organization uses [Azure Active Directory](https://azure.microsoft.com) to provide SSO login to the AWS console, then there is no easy way to log in on the command line or to use the [AWS CLI](https://aws.amazon.com/cli/). This tool fixes that. It lets you use the normal Azure AD login (including MFA) from a command line to create a federated AWS session and places the temporary credentials in the proper place for the AWS CLI and SDKs.
8
+ Log in to AWS CLI using [Azure Active Directory](https://azure.microsoft.com) SSO. Supports MFA and places temporary credentials in the proper location for AWS CLI and SDKs.
9
9
 
10
10
  ## Installation
11
11
 
12
12
  ### mise (Recommended)
13
13
 
14
- [mise](https://mise.jdx.dev/) is a polyglot version manager that can install az2aws directly.
14
+ [mise](https://mise.jdx.dev/) is a version manager that can install az2aws directly.
15
15
 
16
16
  Install mise:
17
17
 
@@ -66,12 +66,10 @@ Run az2aws with a volume mounted to your AWS configuration directory:
66
66
 
67
67
  docker run --rm -it -v ~/.aws:/root/.aws az2aws/az2aws
68
68
 
69
- The Docker image is configured with an entrypoint so you can just feed any arguments in at the end.
70
-
71
- You can also put the docker-launch.sh script into your bin directory for the az2aws command to function as usual:
69
+ You can also install the docker-launch.sh script to your PATH:
72
70
 
73
71
  # Download the script (replace VERSION with a specific release tag, e.g., v1.0.0)
74
- curl -o /tmp/az2aws https://raw.githubusercontent.com/az2aws/az2aws/VERSION/docker-launch.sh -L
72
+ curl -o /tmp/az2aws https://raw.githubusercontent.com/kuma0128/az2aws/VERSION/docker-launch.sh -L
75
73
 
76
74
  # IMPORTANT: Review the script before installing
77
75
  cat /tmp/az2aws
@@ -80,9 +78,7 @@ You can also put the docker-launch.sh script into your bin directory for the az2
80
78
  sudo mv /tmp/az2aws /usr/local/bin/az2aws
81
79
  sudo chmod +x /usr/local/bin/az2aws
82
80
 
83
- > **Security Note:** Always download from a specific release tag (not `main`) and review the script contents before installing. Downloading and executing scripts directly from mutable branch heads poses a supply chain risk.
84
-
85
- Now just run `az2aws`.
81
+ > **Security Note:** Always download from a specific release tag (not `main`) and review the script before installing.
86
82
 
87
83
  ### Snap
88
84
 
@@ -104,13 +100,12 @@ https://snapcraft.io/az2aws
104
100
  | `--enable-chrome-seamless-sso` | Enable Azure AD Seamless SSO |
105
101
  | `--no-disable-extensions` | Keep browser extensions enabled |
106
102
  | `--disable-gpu` | Disable GPU acceleration |
103
+ | `--version (-v)` | Show version number |
107
104
 
108
105
  ## Usage
109
106
 
110
107
  ### Configuration
111
108
 
112
- #### AWS
113
-
114
109
  To configure the az2aws client run:
115
110
 
116
111
  az2aws --configure
@@ -119,22 +114,16 @@ You'll need your [Azure Tenant ID and the App ID URI](#getting-your-tenant-id-an
119
114
 
120
115
  az2aws --configure --profile foo
121
116
 
122
- ##### GovCloud Support
123
-
124
- To use az2aws with AWS GovCloud, set the `region` profile property in your ~/.aws/config to the one of the GovCloud regions:
125
-
126
- - us-gov-west-1
127
- - us-gov-east-1
128
-
129
- ##### China Region Support
117
+ #### GovCloud / China Region Support
130
118
 
131
- To use az2aws with AWS China Cloud, set the `region` profile property in your ~/.aws/config to the China region:
119
+ Set the `region` in your ~/.aws/config to use non-standard AWS partitions:
132
120
 
133
- - cn-north-1
121
+ - **GovCloud**: us-gov-west-1, us-gov-east-1
122
+ - **China**: cn-north-1, cn-northwest-1
134
123
 
135
124
  #### Stay Logged In
136
125
 
137
- During configuration, you can enable "Stay logged in" to skip username/password/MFA on subsequent logins. Session cookies will remember your identity, allowing you to use `--no-prompt` without storing passwords:
126
+ Enable "Stay logged in" during configuration to use `--no-prompt` without storing passwords:
138
127
 
139
128
  az2aws --no-prompt
140
129
  az2aws --profile foo --no-prompt
@@ -154,28 +143,26 @@ To avoid storing passwords in bash history, use a leading space:
154
143
 
155
144
  #### Use an Existing Chrome Install and Profile
156
145
 
157
- Instead of using the bundled Chromium, you can use an existing Chrome installation with your own user profile by setting the following environment variables:
146
+ Use your own Chrome installation by setting these environment variables:
158
147
 
159
148
  - `BROWSER_CHROME_BIN` - Path to Chrome executable
160
149
  - `BROWSER_USER_DATA_DIR` - Chrome user data directory
161
150
  - `BROWSER_PROFILE_DIR` - Chrome profile name (e.g., "Default")
162
151
 
163
- Example (macOS):
152
+ Example:
164
153
 
154
+ # macOS
165
155
  export BROWSER_CHROME_BIN="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
166
- export BROWSER_USER_DATA_DIR="/Users/<user>/Library/Application Support/Google/Chrome"
167
- export BROWSER_PROFILE_DIR="Default"
168
- az2aws --mode gui --no-disable-extensions --no-sandbox
169
-
170
- Example (Linux):
156
+ export BROWSER_USER_DATA_DIR="$HOME/Library/Application Support/Google/Chrome"
171
157
 
158
+ # Linux
172
159
  export BROWSER_CHROME_BIN="/usr/bin/google-chrome"
173
- export BROWSER_USER_DATA_DIR="/home/<user>/.config/google-chrome"
160
+ export BROWSER_USER_DATA_DIR="$HOME/.config/google-chrome"
161
+
162
+ # Common
174
163
  export BROWSER_PROFILE_DIR="Default"
175
164
  az2aws --mode gui --no-disable-extensions --no-sandbox
176
165
 
177
- Using Chrome instead of Chromium allows you to use browser extensions such as password managers.
178
-
179
166
  ### Logging In
180
167
 
181
168
  az2aws # Default profile
@@ -187,12 +174,11 @@ You'll be prompted for username, password, and MFA if required. After login, use
187
174
  **Tips:**
188
175
  - Set `AWS_PROFILE` env var instead of using `--profile`
189
176
  - Use `--mode gui --disable-gpu` on VMs or if rendering fails
190
- - Use `--no-sandbox` on Linux
191
177
  - Set `https_proxy` env var for corporate proxy
192
178
 
193
179
  ## Automation
194
180
 
195
- Renew all profiles at once (useful for short session limits):
181
+ Renew all profiles at once:
196
182
 
197
183
  az2aws --all-profiles
198
184
  az2aws --all-profiles --no-prompt # With "Stay logged in" enabled
@@ -201,21 +187,21 @@ Credentials are only refreshed if expiring within 11 minutes - safe to run as a
201
187
 
202
188
  ## Getting Your Tenant ID and App ID URI
203
189
 
204
- Your Azure AD system admin should be able to provide you with your Tenant ID and App ID URI. If you can't get it from them, you can scrape it from a login page from the myapps.microsoft.com page.
190
+ Ask your Azure AD admin for these values, or extract them from myapps.microsoft.com:
205
191
 
206
192
  1. Load the myapps.microsoft.com page.
207
- 2. Click the chicklet for the login you want.
208
- 3. In the window the pops open quickly copy the login.microsoftonline.com URL. (If you miss it just try again. You can also open the developer console with nagivation preservation to capture the URL.)
193
+ 2. Click the app tile for the login you want.
194
+ 3. In the window that pops open, quickly copy the login.microsoftonline.com URL. (You can also use browser DevTools with "Preserve log" enabled to capture it.)
209
195
  4. The GUID right after login.microsoftonline.com/ is the tenant ID.
210
196
  5. Copy the SAMLRequest URL param.
211
197
  6. Paste it into a URL decoder ([like this one](https://www.samltool.com/url.php)) and decode.
212
- 7. Paste the decoded output into the a SAML deflated and encoded XML decoder ([like this one](https://www.samltool.com/decode.php)).
198
+ 7. Paste the decoded output into a SAML deflated and encoded XML decoder ([like this one](https://www.samltool.com/decode.php)).
213
199
  8. In the decoded XML output the value of the `Audience` tag is the App ID URI.
214
- 9. You may double-check tenant ID using `Attribute` tag named `tenantid` provided in XML.
200
+ 9. Verify the tenant ID using the `tenantid` attribute in the XML.
215
201
 
216
202
  ## How It Works
217
203
 
218
- The Azure login page uses JavaScript, which requires a real web browser. To automate this from a command line, az2aws uses [Puppeteer](https://github.com/GoogleChrome/puppeteer), which automates a real Chromium browser. It loads the Azure login page behind the scenes, populates your username and password (and MFA token), parses the SAML assertion, uses the [AWS STS AssumeRoleWithSAML API](http://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRoleWithSAML.html) to get temporary credentials, and saves these in the CLI credentials file.
204
+ az2aws uses [Puppeteer](https://github.com/GoogleChrome/puppeteer) to automate a Chromium browser for Azure AD login. It parses the SAML response and calls [AWS STS AssumeRoleWithSAML](http://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRoleWithSAML.html) to get temporary credentials.
219
205
 
220
206
  ## Troubleshooting
221
207
 
@@ -227,7 +213,7 @@ If login fails, try these in order:
227
213
 
228
214
  ## Support for Other Authentication Providers
229
215
 
230
- Obviously, this tool only supports Azure AD as an identity provider. However, there is a lot of similarity with how other logins with other providers would work (especially if they are SAML providers). If you are interested in building support for a different provider let me know. It would be great to build a more generic AWS CLI login tool with plugins for the various providers.
216
+ This tool only supports Azure AD. Contributions for other SAML providers are welcome - open an issue on GitHub to discuss.
231
217
 
232
218
  ## Acknowledgements
233
219
 
package/lib/index.js CHANGED
@@ -6,8 +6,11 @@ process.on("SIGTERM", () => process.exit(1));
6
6
  const commander_1 = require("commander");
7
7
  const configureProfileAsync_1 = require("./configureProfileAsync");
8
8
  const login_1 = require("./login");
9
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
10
+ const { version } = require("../package.json");
9
11
  const program = new commander_1.Command();
10
12
  program
13
+ .version(version, "-v, --version")
11
14
  .option("-p, --profile <name>", "The name of the profile to log in with (or configure)")
12
15
  .option("-a, --all-profiles", "Run for all configured profiles")
13
16
  .option("-f, --force-refresh", "Force a credential refresh, even if they are still valid")
@@ -16,7 +19,7 @@ program
16
19
  .option("--no-sandbox", "Disable the Puppeteer sandbox (usually necessary on Linux)")
17
20
  .option("--no-prompt", "Do not prompt for input and accept the default choice", false)
18
21
  .option("--enable-chrome-network-service", "Enable Chromium's Network Service (needed when login provider redirects with 3XX)")
19
- .option("--no-verify-ssl", "Disable SSL Peer Verification for connections to AWS (no effect if behind proxy)")
22
+ .option("--no-verify-ssl", "Disable SSL Peer Verification for connections to AWS")
20
23
  .option("--enable-chrome-seamless-sso", "Enable Chromium's pass-through authentication with Azure Active Directory Seamless Single Sign-On")
21
24
  .option("--no-disable-extensions", "Tell Puppeteer not to pass the --disable-extensions flag to Chromium")
22
25
  .option("--disable-gpu", "Tell Puppeteer to pass the --disable-gpu flag to Chromium")
@@ -49,6 +52,7 @@ Promise.resolve()
49
52
  process.exit(2);
50
53
  }
51
54
  else {
52
- console.log(err);
55
+ console.error(err);
56
+ process.exit(1);
53
57
  }
54
58
  });
package/lib/login.js CHANGED
@@ -16,7 +16,7 @@ const querystring_1 = __importDefault(require("querystring"));
16
16
  const debug_1 = __importDefault(require("debug"));
17
17
  const CLIError_1 = require("./CLIError");
18
18
  const awsConfig_1 = require("./awsConfig");
19
- const proxy_agent_1 = __importDefault(require("proxy-agent"));
19
+ const https_proxy_agent_1 = require("https-proxy-agent");
20
20
  const paths_1 = require("./paths");
21
21
  const mkdirp_1 = __importDefault(require("mkdirp"));
22
22
  const https_1 = require("https");
@@ -674,8 +674,8 @@ exports.login = {
674
674
  * @private
675
675
  */
676
676
  _parseRolesFromSamlResponse(assertion) {
677
- debug("Converting assertion from base64 to ASCII");
678
- const samlText = Buffer.from(assertion, "base64").toString("ascii");
677
+ debug("Converting assertion from base64 to UTF-8");
678
+ const samlText = Buffer.from(assertion, "base64").toString("utf8");
679
679
  debug("Converted", samlText);
680
680
  debug("Parsing SAML XML");
681
681
  const saml = (0, cheerio_1.load)(samlText, { xmlMode: true });
@@ -710,7 +710,7 @@ exports.login = {
710
710
  */
711
711
  async _askUserForRoleAndDurationAsync(roles, noPrompt, defaultRoleArn, defaultDurationHours) {
712
712
  let role;
713
- let durationHours = parseInt(defaultDurationHours, 10);
713
+ let durationHours = parseInt(defaultDurationHours, 10) || 1;
714
714
  const questions = [];
715
715
  if (roles.length === 0) {
716
716
  throw new CLIError_1.CLIError("No roles found in SAML response.");
@@ -784,18 +784,21 @@ exports.login = {
784
784
  var _a, _b, _c, _d, _e;
785
785
  console.log(`Assuming role ${role.roleArn} in region ${region}...`);
786
786
  let stsOptions = {};
787
+ if (awsNoVerifySsl) {
788
+ console.warn("WARNING: SSL certificate verification is disabled. " +
789
+ "This makes the connection vulnerable to MITM attacks. " +
790
+ "Consider using NODE_EXTRA_CA_CERTS environment variable instead.");
791
+ }
787
792
  if (process.env.https_proxy) {
793
+ const proxyOptions = awsNoVerifySsl ? { rejectUnauthorized: false } : {};
788
794
  stsOptions = {
789
795
  ...stsOptions,
790
796
  requestHandler: new node_http_handler_1.NodeHttpHandler({
791
- httpsAgent: (0, proxy_agent_1.default)(process.env.https_proxy),
797
+ httpsAgent: new https_proxy_agent_1.HttpsProxyAgent(process.env.https_proxy, proxyOptions),
792
798
  }),
793
799
  };
794
800
  }
795
- if (awsNoVerifySsl) {
796
- console.warn("WARNING: SSL certificate verification is disabled. " +
797
- "This makes the connection vulnerable to MITM attacks. " +
798
- "Consider using NODE_EXTRA_CA_CERTS environment variable instead.");
801
+ else if (awsNoVerifySsl) {
799
802
  stsOptions = {
800
803
  ...stsOptions,
801
804
  requestHandler: new node_http_handler_1.NodeHttpHandler({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "az2aws",
3
- "version": "1.1.2",
3
+ "version": "1.2.0",
4
4
  "description": "Use Azure AD SSO to log into the AWS CLI. A modern, actively maintained alternative to aws-azure-login.",
5
5
  "main": "index.js",
6
6
  "author": {
@@ -60,11 +60,11 @@
60
60
  "cheerio": "^1.0.0-rc.10",
61
61
  "commander": "^9.5.0",
62
62
  "debug": "^4.3.1",
63
+ "https-proxy-agent": "^7.0.6",
63
64
  "ini": "^3.0.1",
64
65
  "inquirer": "^8.2.6",
65
66
  "lodash": "^4.17.21",
66
67
  "mkdirp": "^1.0.4",
67
- "proxy-agent": "^6.4.0",
68
68
  "puppeteer": "^24.34.0",
69
69
  "uuid": "^8.3.2"
70
70
  },