@azure/identity 2.1.0-alpha.20220419.3 → 2.1.0-alpha.20220421.1

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.

Potentially problematic release.


This version of @azure/identity might be problematic. Click here for more details.

package/CHANGELOG.md CHANGED
@@ -15,6 +15,7 @@
15
15
  ### Other Changes
16
16
 
17
17
  - Upgraded to `@azure/core-tracing` version `^1.0.0`.
18
+ - Improved the errors displayed on the `AzureCliCredential`.
18
19
 
19
20
  ## 2.1.0-beta.2 (2022-03-22)
20
21
 
package/README.md CHANGED
@@ -120,12 +120,12 @@ If used from Node.js, the `DefaultAzureCredential` will attempt to authenticate
120
120
 
121
121
  ![DefaultAzureCredential authentication flow][defaultauthflow_image]
122
122
 
123
- - Environment - The `DefaultAzureCredential` will read account information specified via [environment variables](#environment-variables) and use it to authenticate.
124
- - Managed Identity - If the application is deployed to an Azure host with Managed Identity enabled, the `DefaultAzureCredential` will authenticate with that account.
125
- - Visual Studio Code - If the developer has authenticated with the [Visual Studio Code Azure Account extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.azure-account), the `DefaultAzureCredential` will authenticate using that account.
126
- - In `@azure/identity` version 2.0 or later, the [`@azure/identity-vscode`](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity-vscode) package must be installed for the Visual Studio Code authentication to work.
127
- - Azure CLI - If the developer has authenticated an account via the Azure CLI `az login` command, the `DefaultAzureCredential` will authenticate with that account.
128
- - Azure PowerShell - If the developer has authenticated using the Azure PowerShell module `Connect-AzAccount` command, the `DefaultAzureCredential` will authenticate with that account.
123
+ 1. **Environment** - The `DefaultAzureCredential` will read account information specified via [environment variables](#environment-variables) and use it to authenticate.
124
+ 1. **Managed Identity** - If the application is deployed to an Azure host with Managed Identity enabled, the `DefaultAzureCredential` will authenticate with that account.
125
+ 1. **Visual Studio Code** - If the developer has authenticated with the [Visual Studio Code Azure Account extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.azure-account), the `DefaultAzureCredential` will authenticate using that account.
126
+ - In `@azure/identity` version 2.0 or later, the [`@azure/identity-vscode`](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity-vscode) package must be installed for the Visual Studio Code authentication to work.
127
+ 1. **Azure CLI** - If the developer has authenticated an account via the Azure CLI `az login` command, the `DefaultAzureCredential` will authenticate with that account.
128
+ 1. **Azure PowerShell** - If the developer has authenticated using the Azure PowerShell module `Connect-AzAccount` command, the `DefaultAzureCredential` will authenticate with that account.
129
129
 
130
130
  ## Plugins
131
131
 
@@ -366,6 +366,6 @@ If you'd like to contribute to this library, please read the [contributing guide
366
366
  [azureclilogin_image]: https://raw.githubusercontent.com/Azure/azure-sdk-for-js/main/sdk/identity/identity/images/AzureCliLogin.png
367
367
  [azureclilogindevicecode_image]: https://raw.githubusercontent.com/Azure/azure-sdk-for-js/main/sdk/identity/identity/images/AzureCliLoginDeviceCode.png
368
368
  [azurepowershelllogin_image]: https://raw.githubusercontent.com/Azure/azure-sdk-for-js/main/sdk/identity/identity/images/AzurePowerShellLogin.png
369
- [defaultauthflow_image]: https://raw.githubusercontent.com/Azure/azure-sdk-for-js/main/sdk/identity/identity/images/DefaultAzureCredentialAuthenticationFlow.png
369
+ [defaultauthflow_image]: https://raw.githubusercontent.com/Azure/azure-sdk-for-js/main/sdk/identity/identity/images/mermaidjs/DefaultAzureCredentialAuthFlow.svg
370
370
 
371
371
  ![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fidentity%2Fidentity%2FREADME.png)
package/dist/index.js CHANGED
@@ -1542,13 +1542,14 @@ class AzureCliCredential {
1542
1542
  ensureValidScope(scope, logger$h);
1543
1543
  const resource = getScopeResource(scope);
1544
1544
  return tracingClient.withSpan(`${this.constructor.name}.getToken`, options, async () => {
1545
- var _a, _b, _c;
1545
+ var _a, _b, _c, _d;
1546
1546
  try {
1547
1547
  const obj = await cliCredentialInternals.getAzureCliAccessToken(resource, tenantId);
1548
- const isLoginError = (_a = obj.stderr) === null || _a === void 0 ? void 0 : _a.match("(.*)az login(.*)");
1549
- const isNotInstallError = ((_b = obj.stderr) === null || _b === void 0 ? void 0 : _b.match("az:(.*)not found")) || ((_c = obj.stderr) === null || _c === void 0 ? void 0 : _c.startsWith("'az' is not recognized"));
1548
+ const specificScope = (_a = obj.stderr) === null || _a === void 0 ? void 0 : _a.match("(.*)az login --scope(.*)");
1549
+ const isLoginError = ((_b = obj.stderr) === null || _b === void 0 ? void 0 : _b.match("(.*)az login(.*)")) && !specificScope;
1550
+ const isNotInstallError = ((_c = obj.stderr) === null || _c === void 0 ? void 0 : _c.match("az:(.*)not found")) || ((_d = obj.stderr) === null || _d === void 0 ? void 0 : _d.startsWith("'az' is not recognized"));
1550
1551
  if (isNotInstallError) {
1551
- const error = new CredentialUnavailableError("Azure CLI could not be found. Please visit https://aka.ms/azure-cli for installation instructions and then, once installed, authenticate to your Azure account using 'az login'.");
1552
+ const error = new CredentialUnavailableError("Azure CLI could not be found. Please visit https://aka.ms/azure-cli for installation instructions and then, once installed, authenticate to your Azure account using 'az login'.");
1552
1553
  logger$h.getToken.info(formatError(scopes, error));
1553
1554
  throw error;
1554
1555
  }