@azure/identity 2.1.0-beta.2 → 2.1.1-alpha.20220803.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.

Files changed (88) hide show
  1. package/README.md +65 -33
  2. package/dist/index.js +363 -305
  3. package/dist/index.js.map +1 -1
  4. package/dist-esm/src/client/identityClient.js +34 -45
  5. package/dist-esm/src/client/identityClient.js.map +1 -1
  6. package/dist-esm/src/constants.js +4 -0
  7. package/dist-esm/src/constants.js.map +1 -1
  8. package/dist-esm/src/credentials/authorizationCodeCredential.browser.js.map +1 -1
  9. package/dist-esm/src/credentials/authorizationCodeCredential.js +4 -3
  10. package/dist-esm/src/credentials/authorizationCodeCredential.js.map +1 -1
  11. package/dist-esm/src/credentials/azureCliCredential.js +34 -34
  12. package/dist-esm/src/credentials/azureCliCredential.js.map +1 -1
  13. package/dist-esm/src/credentials/azurePowerShellCredential.browser.js.map +1 -1
  14. package/dist-esm/src/credentials/azurePowerShellCredential.js +3 -3
  15. package/dist-esm/src/credentials/azurePowerShellCredential.js.map +1 -1
  16. package/dist-esm/src/credentials/chainedTokenCredential.js +28 -33
  17. package/dist-esm/src/credentials/chainedTokenCredential.js.map +1 -1
  18. package/dist-esm/src/credentials/clientAssertionCredential.browser.js +22 -0
  19. package/dist-esm/src/credentials/clientAssertionCredential.browser.js.map +1 -0
  20. package/dist-esm/src/credentials/clientAssertionCredential.js +45 -0
  21. package/dist-esm/src/credentials/clientAssertionCredential.js.map +1 -0
  22. package/dist-esm/src/credentials/clientCertificateCredential.browser.js.map +1 -1
  23. package/dist-esm/src/credentials/clientCertificateCredential.js +2 -2
  24. package/dist-esm/src/credentials/clientCertificateCredential.js.map +1 -1
  25. package/dist-esm/src/credentials/clientSecretCredential.browser.js +31 -38
  26. package/dist-esm/src/credentials/clientSecretCredential.browser.js.map +1 -1
  27. package/dist-esm/src/credentials/clientSecretCredential.js +2 -2
  28. package/dist-esm/src/credentials/clientSecretCredential.js.map +1 -1
  29. package/dist-esm/src/credentials/defaultAzureCredential.js +3 -3
  30. package/dist-esm/src/credentials/defaultAzureCredential.js.map +1 -1
  31. package/dist-esm/src/credentials/deviceCodeCredential.browser.js.map +1 -1
  32. package/dist-esm/src/credentials/deviceCodeCredential.js +3 -3
  33. package/dist-esm/src/credentials/deviceCodeCredential.js.map +1 -1
  34. package/dist-esm/src/credentials/environmentCredential.js +7 -4
  35. package/dist-esm/src/credentials/environmentCredential.js.map +1 -1
  36. package/dist-esm/src/credentials/interactiveBrowserCredential.browser.js +3 -3
  37. package/dist-esm/src/credentials/interactiveBrowserCredential.browser.js.map +1 -1
  38. package/dist-esm/src/credentials/interactiveBrowserCredential.js +3 -3
  39. package/dist-esm/src/credentials/interactiveBrowserCredential.js.map +1 -1
  40. package/dist-esm/src/credentials/managedIdentityCredential/appServiceMsi2017.js.map +1 -1
  41. package/dist-esm/src/credentials/managedIdentityCredential/appServiceMsi2019.js.map +1 -1
  42. package/dist-esm/src/credentials/managedIdentityCredential/arcMsi.js.map +1 -1
  43. package/dist-esm/src/credentials/managedIdentityCredential/cloudShellMsi.js.map +1 -1
  44. package/dist-esm/src/credentials/managedIdentityCredential/fabricMsi.js.map +1 -1
  45. package/dist-esm/src/credentials/managedIdentityCredential/imdsMsi.js +38 -49
  46. package/dist-esm/src/credentials/managedIdentityCredential/imdsMsi.js.map +1 -1
  47. package/dist-esm/src/credentials/managedIdentityCredential/index.js +11 -13
  48. package/dist-esm/src/credentials/managedIdentityCredential/index.js.map +1 -1
  49. package/dist-esm/src/credentials/managedIdentityCredential/tokenExchangeMsi.js.map +1 -1
  50. package/dist-esm/src/credentials/onBehalfOfCredential.browser.js.map +1 -1
  51. package/dist-esm/src/credentials/onBehalfOfCredential.js +2 -2
  52. package/dist-esm/src/credentials/onBehalfOfCredential.js.map +1 -1
  53. package/dist-esm/src/credentials/usernamePasswordCredential.browser.js +5 -6
  54. package/dist-esm/src/credentials/usernamePasswordCredential.browser.js.map +1 -1
  55. package/dist-esm/src/credentials/usernamePasswordCredential.js +2 -2
  56. package/dist-esm/src/credentials/usernamePasswordCredential.js.map +1 -1
  57. package/dist-esm/src/credentials/visualStudioCodeCredential.browser.js.map +1 -1
  58. package/dist-esm/src/credentials/visualStudioCodeCredential.js.map +1 -1
  59. package/dist-esm/src/errors.js.map +1 -1
  60. package/dist-esm/src/index.js +1 -0
  61. package/dist-esm/src/index.js.map +1 -1
  62. package/dist-esm/src/msal/browserFlows/msalAuthCode.js.map +1 -1
  63. package/dist-esm/src/msal/browserFlows/msalBrowserCommon.js +1 -1
  64. package/dist-esm/src/msal/browserFlows/msalBrowserCommon.js.map +1 -1
  65. package/dist-esm/src/msal/credentials.js.map +1 -1
  66. package/dist-esm/src/msal/flows.js.map +1 -1
  67. package/dist-esm/src/msal/nodeFlows/msalAuthorizationCode.js +2 -2
  68. package/dist-esm/src/msal/nodeFlows/msalAuthorizationCode.js.map +1 -1
  69. package/dist-esm/src/msal/nodeFlows/msalClientAssertion.js +42 -0
  70. package/dist-esm/src/msal/nodeFlows/msalClientAssertion.js.map +1 -0
  71. package/dist-esm/src/msal/nodeFlows/msalClientCertificate.js +22 -4
  72. package/dist-esm/src/msal/nodeFlows/msalClientCertificate.js.map +1 -1
  73. package/dist-esm/src/msal/nodeFlows/msalClientSecret.js.map +1 -1
  74. package/dist-esm/src/msal/nodeFlows/msalDeviceCode.js.map +1 -1
  75. package/dist-esm/src/msal/nodeFlows/msalNodeCommon.js +7 -1
  76. package/dist-esm/src/msal/nodeFlows/msalNodeCommon.js.map +1 -1
  77. package/dist-esm/src/msal/nodeFlows/msalOnBehalfOf.js.map +1 -1
  78. package/dist-esm/src/msal/nodeFlows/msalOpenBrowser.js +2 -1
  79. package/dist-esm/src/msal/nodeFlows/msalOpenBrowser.js.map +1 -1
  80. package/dist-esm/src/msal/nodeFlows/msalUsernamePassword.js.map +1 -1
  81. package/dist-esm/src/msal/utils.js +1 -1
  82. package/dist-esm/src/msal/utils.js.map +1 -1
  83. package/dist-esm/src/util/logging.js.map +1 -1
  84. package/dist-esm/src/util/tracing.js +5 -36
  85. package/dist-esm/src/util/tracing.js.map +1 -1
  86. package/package.json +27 -21
  87. package/types/identity.d.ts +39 -0
  88. package/CHANGELOG.md +0 -544
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- ## Azure Identity client library for JavaScript
1
+ # Azure Identity client library for JavaScript
2
2
 
3
3
  The Azure Identity library provides [Azure Active Directory (Azure AD)](https://docs.microsoft.com/azure/active-directory/fundamentals/active-directory-whatis) token authentication through a set of convenient [TokenCredential](https://docs.microsoft.com/javascript/api/@azure/core-auth/tokencredential) implementations.
4
4
 
@@ -90,10 +90,12 @@ If interactive authentication cannot be supported in the session, then the `-Use
90
90
 
91
91
  Developers using Visual Studio Code can use the [Azure Account extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.azure-account) to authenticate via the editor. Apps using `DefaultAzureCredential` or `VisualStudioCodeCredential` can then use this account to authenticate calls in their app when running locally.
92
92
 
93
- To authenticate in Visual Studio Code, ensure **version 0.9.11 or earlier** of the Azure Account extension is installed. To track progress toward supporting newer extension versions, see [this GitHub issue](https://github.com/Azure/azure-sdk-for-net/issues/27263). Once installed, open the **Command Palette** and run the **Azure: Sign In** command.
93
+ To authenticate in Visual Studio Code, ensure the Azure Account extension is installed. Once installed, open the **Command Palette** and run the **Azure: Sign In** command.
94
94
 
95
95
  Additionally, use the [`@azure/identity-vscode`](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity-vscode) plugin package. This package provides the dependencies of `VisualStudioCodeCredential` and enables it. See [Plugins](##plugins).
96
96
 
97
+ It's a [known issue](https://github.com/Azure/azure-sdk-for-js/issues/20500) that `VisualStudioCodeCredential` doesn't work with [Azure Account extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.azure-account) versions newer than **0.9.11**. A long-term fix to this problem is in progress. In the meantime, consider [authenticating via the Azure CLI](#authenticating-via-the-azure-cli).
98
+
97
99
  ### Authenticate the client in browsers
98
100
 
99
101
  To authenticate Azure SDKs within web browsers, we currently offer the `InteractiveBrowserCredential`, which can be set to use redirection or popups to complete the authentication flow. It is necessary to [create an Azure App Registration](https://docs.microsoft.com/azure/active-directory/develop/scenario-spa-app-registration) in the portal for your web application first.
@@ -120,12 +122,12 @@ If used from Node.js, the `DefaultAzureCredential` will attempt to authenticate
120
122
 
121
123
  ![DefaultAzureCredential authentication flow][defaultauthflow_image]
122
124
 
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.
125
+ 1. **Environment** - The `DefaultAzureCredential` will read account information specified via [environment variables](#environment-variables) and use it to authenticate.
126
+ 1. **Managed Identity** - If the application is deployed to an Azure host with Managed Identity enabled, the `DefaultAzureCredential` will authenticate with that account.
127
+ 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.
128
+ - 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.
129
+ 1. **Azure CLI** - If the developer has authenticated an account via the Azure CLI `az login` command, the `DefaultAzureCredential` will authenticate with that account.
130
+ 1. **Azure PowerShell** - If the developer has authenticated using the Azure PowerShell module `Connect-AzAccount` command, the `DefaultAzureCredential` will authenticate with that account.
129
131
 
130
132
  ## Plugins
131
133
 
@@ -235,7 +237,7 @@ const credential = new ClientSecretCredential(
235
237
  "<YOUR_CLIENT_ID>",
236
238
  "<YOUR_CLIENT_SECRET>",
237
239
  {
238
- authorityHost: AzureAuthorityHosts.AzureGovernment
240
+ authorityHost: AzureAuthorityHosts.AzureGovernment,
239
241
  }
240
242
  );
241
243
  ```
@@ -244,37 +246,39 @@ Not all credentials require this configuration. Credentials that authenticate th
244
246
 
245
247
  ## Credential Classes
246
248
 
247
- ### Authenticating Azure Hosted Applications
249
+ ### Authenticating Azure-hosted applications
248
250
 
249
- | credential | usage | example |
250
- | --------------------------- | ---------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
251
- | `DefaultAzureCredential` | Provides a simplified authentication experience to quickly start developing applications run in the Azure cloud. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-defaultazurecredential) |
252
- | `ChainedTokenCredential` | Allows users to define custom authentication flows composing multiple credentials. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#chaining-credentials) |
253
- | `EnvironmentCredential` | Authenticates a service principal or user via credential information specified in environment variables. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-service-principal-with-environment-credentials) |
254
- | `ManagedIdentityCredential` | Authenticates the managed identity of an Azure resource. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-in-azure-with-managed-identity) |
251
+ | Credential | Usage | Example |
252
+ | ----------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
253
+ | [`DefaultAzureCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/defaultazurecredential?view=azure-node-latest) | Provides a simplified authentication experience to quickly start developing applications run in the Azure cloud. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-defaultazurecredential) |
254
+ | [`ChainedTokenCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/chainedtokencredential?view=azure-node-latest) | Allows users to define custom authentication flows composing multiple credentials. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#chaining-credentials) |
255
+ | [`EnvironmentCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/environmentcredential?view=azure-node-latest) | Authenticates a service principal or user via credential information specified in environment variables. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-service-principal-with-environment-credentials) |
256
+ | [`ManagedIdentityCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/managedidentitycredential?view=azure-node-latest) | Authenticates the managed identity of an Azure resource. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-in-azure-with-managed-identity) |
255
257
 
256
258
  ### Authenticating Service Principals
257
259
 
258
- | credential | usage | example | reference |
259
- | ----------------------------- | ------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
260
- | `ClientSecretCredential` | Authenticates a service principal using a secret. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-service-principal-with-a-client-secret) | [Service principal authentication](https://docs.microsoft.com/azure/active-directory/develop/app-objects-and-service-principals) |
261
- | `ClientCertificateCredential` | Authenticates a service principal using a certificate. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-service-principal-with-a-client-certificate) | [Service principal authentication](https://docs.microsoft.com/azure/active-directory/develop/app-objects-and-service-principals) |
260
+ | Credential | Usage | Example | Reference |
261
+ | --------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
262
+ | `ClientAssertionCredential` | Authenticates a service principal using a certificate. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-service-principal-with-a-client-assertion) | [Service principal authentication](https://docs.microsoft.com/azure/active-directory/develop/app-objects-and-service-principals) |
263
+ | [`ClientCertificateCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/clientcertificatecredential?view=azure-node-latest) | Authenticates a service principal using a certificate. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-service-principal-with-a-client-certificate) | [Service principal authentication](https://docs.microsoft.com/azure/active-directory/develop/app-objects-and-service-principals) |
264
+ | [`ClientSecretCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/clientsecretcredential?view=azure-node-latest) | Authenticates a service principal using a secret. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-service-principal-with-a-client-secret) | [Service principal authentication](https://docs.microsoft.com/azure/active-directory/develop/app-objects-and-service-principals) |
262
265
 
263
266
  ### Authenticating Users
264
267
 
265
- | credential | usage | example | reference |
266
- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
267
- | `InteractiveBrowserCredential` | Interactively authenticates a user with the default system browser. Read more about how this happens [here](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/interactive-browser-credential.md). | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-user-account-interactively-in-the-browser) | [OAuth2 authentication code](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-auth-code-flow) |
268
- | `DeviceCodeCredential` | Interactively authenticates a user on devices with limited UI. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-user-account-with-device-code-flow) | [Device code authentication](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-device-code) |
269
- | `UsernamePasswordCredential` | Authenticates a user with a username and password. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-user-account-with-username-and-password) | [Username + password authentication](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth-ropc) |
270
- | `AuthorizationCodeCredential` | Authenticate a user with a previously obtained authorization code. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-user-account-with-auth-code-flow) | [OAuth2 authentication code](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-auth-code-flow) |
268
+ | Credential | Usage | Example | Reference |
269
+ | ----------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
270
+ | [`AuthorizationCodeCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/authorizationcodecredential?view=azure-node-latest) | Authenticates a user with a previously obtained authorization code. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-user-account-with-auth-code-flow) | [OAuth2 authentication code](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-auth-code-flow) |
271
+ | [`DeviceCodeCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/devicecodecredential?view=azure-node-latest) | Interactively authenticates a user on devices with limited UI. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-user-account-with-device-code-flow) | [Device code authentication](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-device-code) |
272
+ | [`InteractiveBrowserCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/interactivebrowsercredential?view=azure-node-latest) | Interactively authenticates a user with the default system browser. Read more about how this happens [here](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/interactive-browser-credential.md). | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-user-account-interactively-in-the-browser) | [OAuth2 authentication code](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-auth-code-flow) |
273
+ | [`OnBehalfOfCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/onbehalfofcredential?view=azure-node-latest) | Propagates the delegated user identity and permissions through the request chain |
274
+ | [`UsernamePasswordCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/usernamepasswordcredential?view=azure-node-latest) | Authenticates a user with a username and password. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-user-account-with-username-and-password) | [Username + password authentication](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth-ropc) |
271
275
 
272
276
  ### Authenticating via Development Tools
273
277
 
274
- | credential | usage | example | reference |
275
- | --------------------------- | ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
276
- | `AzureCliCredential` | Authenticate in a development environment with the Azure CLI. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-user-account-with-azure-cli) | [Azure CLI authentication](https://docs.microsoft.com/cli/azure/authenticate-azure-cli) |
277
- | `AzurePowerShellCredential` | Authenticate in a development environment using Azure PowerShell. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-user-account-with-azure-powershell) | [Azure PowerShell authentication](https://docs.microsoft.com/powershell/azure/authenticate-azureps) |
278
+ | Credential | Usage | Example | Reference |
279
+ | ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
280
+ | [`AzureCliCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/azureclicredential?view=azure-node-latest) | Authenticate in a development environment with the Azure CLI. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-user-account-with-azure-cli) | [Azure CLI authentication](https://docs.microsoft.com/cli/azure/authenticate-azure-cli) |
281
+ | [`AzurePowerShellCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/azurepowershellcredential?view=azure-node-latest) | Authenticate in a development environment using Azure PowerShell. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-user-account-with-azure-powershell) | [Azure PowerShell authentication](https://docs.microsoft.com/powershell/azure/authenticate-azureps) |
278
282
 
279
283
  ## Troubleshooting
280
284
 
@@ -284,7 +288,10 @@ Credentials raise `AuthenticationError` when they fail to authenticate. This cla
284
288
 
285
289
  ### Logging
286
290
 
287
- Enabling logging may help uncover useful information about failures. To see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. You can read this environment variable from the *.env* file by explicitly specifying a file path:
291
+ Enabling logging may help uncover useful information about failures.
292
+
293
+ To see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`.
294
+ You can read this environment variable from the _.env_ file by explicitly specifying a file path:
288
295
 
289
296
  ```javascript
290
297
  require("dotenv").config({ path: ".env" });
@@ -298,7 +305,32 @@ import { setLogLevel } from "@azure/logger";
298
305
  setLogLevel("info");
299
306
  ```
300
307
 
301
- For assistance with troubleshooting, see the [troubleshooting guide](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/TROUBLESHOOTING.md).
308
+ In cases where the authenticate code might be running in an environment with more than one credential available,
309
+ the `@azure/identity` package offers a unique form of logging. On the optional parameters for every credential,
310
+ developers can set `allowLoggingAccountIdentifiers` to true in the
311
+ `loggingOptions` to log information specific to the authenticated account after
312
+ each successful authentication, including the Client ID, the Tenant ID, the
313
+ Object ID of the authenticated user, and if possible the User Principal Name.
314
+
315
+ For example, using the `DefaultAzureCredential`:
316
+
317
+ ```js
318
+ import { setLogLevel } from "@azure/logger";
319
+
320
+ setLogLevel("info");
321
+
322
+ const credential = new DefaultAzureCredential({
323
+ loggingOptions: { allowLoggingAccountIdentifiers: true },
324
+ });
325
+ ```
326
+
327
+ Once that credential authenticates, the following message will appear in the logs (with the real information instead of `HIDDEN`):
328
+
329
+ ```
330
+ azure:identity:info [Authenticated account] Client ID: HIDDEN. Tenant ID: HIDDEN. User Principal Name: HIDDEN. Object ID (user): HIDDEN
331
+ ```
332
+
333
+ For assistance with troubleshooting, see the [troubleshooting guide](https://aka.ms/azsdk/js/identity/troubleshoot).
302
334
 
303
335
  ## Next steps
304
336
 
@@ -338,6 +370,6 @@ If you'd like to contribute to this library, please read the [contributing guide
338
370
  [azureclilogin_image]: https://raw.githubusercontent.com/Azure/azure-sdk-for-js/main/sdk/identity/identity/images/AzureCliLogin.png
339
371
  [azureclilogindevicecode_image]: https://raw.githubusercontent.com/Azure/azure-sdk-for-js/main/sdk/identity/identity/images/AzureCliLoginDeviceCode.png
340
372
  [azurepowershelllogin_image]: https://raw.githubusercontent.com/Azure/azure-sdk-for-js/main/sdk/identity/identity/images/AzurePowerShellLogin.png
341
- [defaultauthflow_image]: https://raw.githubusercontent.com/Azure/azure-sdk-for-js/main/sdk/identity/identity/images/DefaultAzureCredentialAuthenticationFlow.png
373
+ [defaultauthflow_image]: https://raw.githubusercontent.com/Azure/azure-sdk-for-js/main/sdk/identity/identity/images/mermaidjs/DefaultAzureCredentialAuthFlow.svg
342
374
 
343
375
  ![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fidentity%2Fidentity%2FREADME.png)