@azure/identity 2.1.0-beta.1 → 2.1.1-alpha.20220712.2

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 (92) hide show
  1. package/README.md +66 -33
  2. package/dist/index.js +526 -389
  3. package/dist/index.js.map +1 -1
  4. package/dist-esm/src/client/identityClient.js +71 -46
  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 +7 -4
  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 +16 -29
  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 +3 -3
  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 +77 -0
  42. package/dist-esm/src/credentials/managedIdentityCredential/appServiceMsi2019.js.map +1 -0
  43. package/dist-esm/src/credentials/managedIdentityCredential/arcMsi.js.map +1 -1
  44. package/dist-esm/src/credentials/managedIdentityCredential/cloudShellMsi.js.map +1 -1
  45. package/dist-esm/src/credentials/managedIdentityCredential/fabricMsi.js.map +1 -1
  46. package/dist-esm/src/credentials/managedIdentityCredential/imdsMsi.js +38 -49
  47. package/dist-esm/src/credentials/managedIdentityCredential/imdsMsi.js.map +1 -1
  48. package/dist-esm/src/credentials/managedIdentityCredential/index.js +20 -13
  49. package/dist-esm/src/credentials/managedIdentityCredential/index.js.map +1 -1
  50. package/dist-esm/src/credentials/managedIdentityCredential/tokenExchangeMsi.js.map +1 -1
  51. package/dist-esm/src/credentials/onBehalfOfCredential.browser.js.map +1 -1
  52. package/dist-esm/src/credentials/onBehalfOfCredential.js +2 -23
  53. package/dist-esm/src/credentials/onBehalfOfCredential.js.map +1 -1
  54. package/dist-esm/src/credentials/onBehalfOfCredentialOptions.js.map +1 -1
  55. package/dist-esm/src/credentials/usernamePasswordCredential.browser.js +5 -6
  56. package/dist-esm/src/credentials/usernamePasswordCredential.browser.js.map +1 -1
  57. package/dist-esm/src/credentials/usernamePasswordCredential.js +2 -2
  58. package/dist-esm/src/credentials/usernamePasswordCredential.js.map +1 -1
  59. package/dist-esm/src/credentials/visualStudioCodeCredential.browser.js.map +1 -1
  60. package/dist-esm/src/credentials/visualStudioCodeCredential.js.map +1 -1
  61. package/dist-esm/src/errors.js.map +1 -1
  62. package/dist-esm/src/index.js +1 -0
  63. package/dist-esm/src/index.js.map +1 -1
  64. package/dist-esm/src/msal/browserFlows/msalAuthCode.js.map +1 -1
  65. package/dist-esm/src/msal/browserFlows/msalBrowserCommon.js +1 -1
  66. package/dist-esm/src/msal/browserFlows/msalBrowserCommon.js.map +1 -1
  67. package/dist-esm/src/msal/credentials.js.map +1 -1
  68. package/dist-esm/src/msal/flows.js.map +1 -1
  69. package/dist-esm/src/msal/nodeFlows/msalAuthorizationCode.js +2 -2
  70. package/dist-esm/src/msal/nodeFlows/msalAuthorizationCode.js.map +1 -1
  71. package/dist-esm/src/msal/nodeFlows/msalClientAssertion.js +42 -0
  72. package/dist-esm/src/msal/nodeFlows/msalClientAssertion.js.map +1 -0
  73. package/dist-esm/src/msal/nodeFlows/msalClientCertificate.js +8 -3
  74. package/dist-esm/src/msal/nodeFlows/msalClientCertificate.js.map +1 -1
  75. package/dist-esm/src/msal/nodeFlows/msalClientSecret.js.map +1 -1
  76. package/dist-esm/src/msal/nodeFlows/msalDeviceCode.js +0 -2
  77. package/dist-esm/src/msal/nodeFlows/msalDeviceCode.js.map +1 -1
  78. package/dist-esm/src/msal/nodeFlows/msalNodeCommon.js +19 -2
  79. package/dist-esm/src/msal/nodeFlows/msalNodeCommon.js.map +1 -1
  80. package/dist-esm/src/msal/nodeFlows/msalOnBehalfOf.js.map +1 -1
  81. package/dist-esm/src/msal/nodeFlows/msalOpenBrowser.js +2 -1
  82. package/dist-esm/src/msal/nodeFlows/msalOpenBrowser.js.map +1 -1
  83. package/dist-esm/src/msal/nodeFlows/msalUsernamePassword.js.map +1 -1
  84. package/dist-esm/src/msal/utils.js +1 -1
  85. package/dist-esm/src/msal/utils.js.map +1 -1
  86. package/dist-esm/src/tokenCredentialOptions.js.map +1 -1
  87. package/dist-esm/src/util/logging.js.map +1 -1
  88. package/dist-esm/src/util/tracing.js +5 -36
  89. package/dist-esm/src/util/tracing.js.map +1 -1
  90. package/package.json +31 -25
  91. package/types/identity.d.ts +162 -57
  92. package/CHANGELOG.md +0 -530
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
 
@@ -88,12 +88,14 @@ If interactive authentication cannot be supported in the session, then the `-Use
88
88
 
89
89
  #### Authenticate via Visual Studio Code
90
90
 
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 IDE. Apps using `DefaultAzureCredential` or `VisualStudioCodeCredential` can then use this account to authenticate calls in their app when running locally.
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, first ensure the Azure Account extension is installed. Once the extension is 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,11 +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
- - Azure CLI - If the developer has authenticated an account via the Azure CLI `az login` command, the `DefaultAzureCredential` will authenticate with that account.
127
- - 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.
128
131
 
129
132
  ## Plugins
130
133
 
@@ -234,7 +237,7 @@ const credential = new ClientSecretCredential(
234
237
  "<YOUR_CLIENT_ID>",
235
238
  "<YOUR_CLIENT_SECRET>",
236
239
  {
237
- authorityHost: AzureAuthorityHosts.AzureGovernment
240
+ authorityHost: AzureAuthorityHosts.AzureGovernment,
238
241
  }
239
242
  );
240
243
  ```
@@ -243,37 +246,39 @@ Not all credentials require this configuration. Credentials that authenticate th
243
246
 
244
247
  ## Credential Classes
245
248
 
246
- ### Authenticating Azure Hosted Applications
249
+ ### Authenticating Azure-hosted applications
247
250
 
248
- | credential | usage | example |
249
- | --------------------------- | ---------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
250
- | `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) |
251
- | `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) |
252
- | `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) |
253
- | `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) |
254
257
 
255
258
  ### Authenticating Service Principals
256
259
 
257
- | credential | usage | example | reference |
258
- | ----------------------------- | ------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
259
- | `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) |
260
- | `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) |
261
265
 
262
266
  ### Authenticating Users
263
267
 
264
- | credential | usage | example | reference |
265
- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
266
- | `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) |
267
- | `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) |
268
- | `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) |
269
- | `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) |
270
275
 
271
276
  ### Authenticating via Development Tools
272
277
 
273
- | credential | usage | example | reference |
274
- | --------------------------- | ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
275
- | `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) |
276
- | `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) |
277
282
 
278
283
  ## Troubleshooting
279
284
 
@@ -283,7 +288,10 @@ Credentials raise `AuthenticationError` when they fail to authenticate. This cla
283
288
 
284
289
  ### Logging
285
290
 
286
- 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:
287
295
 
288
296
  ```javascript
289
297
  require("dotenv").config({ path: ".env" });
@@ -297,7 +305,32 @@ import { setLogLevel } from "@azure/logger";
297
305
  setLogLevel("info");
298
306
  ```
299
307
 
300
- 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).
301
334
 
302
335
  ## Next steps
303
336
 
@@ -337,6 +370,6 @@ If you'd like to contribute to this library, please read the [contributing guide
337
370
  [azureclilogin_image]: https://raw.githubusercontent.com/Azure/azure-sdk-for-js/main/sdk/identity/identity/images/AzureCliLogin.png
338
371
  [azureclilogindevicecode_image]: https://raw.githubusercontent.com/Azure/azure-sdk-for-js/main/sdk/identity/identity/images/AzureCliLoginDeviceCode.png
339
372
  [azurepowershelllogin_image]: https://raw.githubusercontent.com/Azure/azure-sdk-for-js/main/sdk/identity/identity/images/AzurePowerShellLogin.png
340
- [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
341
374
 
342
375
  ![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fidentity%2Fidentity%2FREADME.png)