@azure/identity 2.0.0-beta.2 → 2.0.0-beta.6

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 (157) hide show
  1. package/CHANGELOG.md +127 -8
  2. package/README.md +88 -45
  3. package/dist/index.js +2237 -1675
  4. package/dist/index.js.map +1 -1
  5. package/dist-esm/src/client/errors.js +1 -1
  6. package/dist-esm/src/client/errors.js.map +1 -1
  7. package/dist-esm/src/client/identityClient.js +146 -132
  8. package/dist-esm/src/client/identityClient.js.map +1 -1
  9. package/dist-esm/src/constants.js +1 -1
  10. package/dist-esm/src/constants.js.map +1 -1
  11. package/dist-esm/src/credentials/applicationCredential.browser.js +29 -0
  12. package/dist-esm/src/credentials/applicationCredential.browser.js.map +1 -0
  13. package/dist-esm/src/credentials/applicationCredential.js +34 -0
  14. package/dist-esm/src/credentials/applicationCredential.js.map +1 -0
  15. package/dist-esm/src/credentials/authorizationCodeCredential.browser.js.map +1 -1
  16. package/dist-esm/src/credentials/authorizationCodeCredential.js +13 -76
  17. package/dist-esm/src/credentials/authorizationCodeCredential.js.map +1 -1
  18. package/dist-esm/src/credentials/azureCliCredential.browser.js.map +1 -1
  19. package/dist-esm/src/credentials/azureCliCredential.js +104 -81
  20. package/dist-esm/src/credentials/azureCliCredential.js.map +1 -1
  21. package/dist-esm/src/credentials/azureCliCredentialOptions.js +4 -0
  22. package/dist-esm/src/credentials/azureCliCredentialOptions.js.map +1 -0
  23. package/dist-esm/src/credentials/azurePowerShellCredential.browser.js +20 -0
  24. package/dist-esm/src/credentials/azurePowerShellCredential.browser.js.map +1 -0
  25. package/dist-esm/src/credentials/azurePowerShellCredential.js +173 -0
  26. package/dist-esm/src/credentials/azurePowerShellCredential.js.map +1 -0
  27. package/dist-esm/src/credentials/azurePowerShellCredentialOptions.js +4 -0
  28. package/dist-esm/src/credentials/azurePowerShellCredentialOptions.js.map +1 -0
  29. package/dist-esm/src/credentials/chainedTokenCredential.js +37 -34
  30. package/dist-esm/src/credentials/chainedTokenCredential.js.map +1 -1
  31. package/dist-esm/src/credentials/clientCertificateCredential.browser.js.map +1 -1
  32. package/dist-esm/src/credentials/clientCertificateCredential.js +9 -11
  33. package/dist-esm/src/credentials/clientCertificateCredential.js.map +1 -1
  34. package/dist-esm/src/credentials/clientCertificateCredentialOptions.js.map +1 -1
  35. package/dist-esm/src/credentials/clientSecretCredential.browser.js +87 -0
  36. package/dist-esm/src/credentials/clientSecretCredential.browser.js.map +1 -0
  37. package/dist-esm/src/credentials/clientSecretCredential.js +9 -11
  38. package/dist-esm/src/credentials/clientSecretCredential.js.map +1 -1
  39. package/dist-esm/src/credentials/clientSecretCredentialOptions.js.map +1 -1
  40. package/dist-esm/src/credentials/credentialPersistenceOptions.js +4 -0
  41. package/dist-esm/src/credentials/credentialPersistenceOptions.js.map +1 -0
  42. package/dist-esm/src/credentials/defaultAzureCredential.browser.js +1 -1
  43. package/dist-esm/src/credentials/defaultAzureCredential.browser.js.map +1 -1
  44. package/dist-esm/src/credentials/defaultAzureCredential.js +38 -19
  45. package/dist-esm/src/credentials/defaultAzureCredential.js.map +1 -1
  46. package/dist-esm/src/credentials/deviceCodeCredential.browser.js.map +1 -1
  47. package/dist-esm/src/credentials/deviceCodeCredential.js +13 -22
  48. package/dist-esm/src/credentials/deviceCodeCredential.js.map +1 -1
  49. package/dist-esm/src/credentials/deviceCodeCredentialOptions.js.map +1 -1
  50. package/dist-esm/src/credentials/environmentCredential.browser.js.map +1 -1
  51. package/dist-esm/src/credentials/environmentCredential.js +47 -30
  52. package/dist-esm/src/credentials/environmentCredential.js.map +1 -1
  53. package/dist-esm/src/credentials/interactiveBrowserCredential.browser.js +14 -23
  54. package/dist-esm/src/credentials/interactiveBrowserCredential.browser.js.map +1 -1
  55. package/dist-esm/src/credentials/interactiveBrowserCredential.js +20 -26
  56. package/dist-esm/src/credentials/interactiveBrowserCredential.js.map +1 -1
  57. package/dist-esm/src/credentials/interactiveBrowserCredentialOptions.js.map +1 -1
  58. package/dist-esm/src/credentials/interactiveCredentialOptions.js.map +1 -1
  59. package/dist-esm/src/credentials/managedIdentityCredential/appServiceMsi2017.js +36 -18
  60. package/dist-esm/src/credentials/managedIdentityCredential/appServiceMsi2017.js.map +1 -1
  61. package/dist-esm/src/credentials/managedIdentityCredential/arcMsi.js +61 -42
  62. package/dist-esm/src/credentials/managedIdentityCredential/arcMsi.js.map +1 -1
  63. package/dist-esm/src/credentials/managedIdentityCredential/cloudShellMsi.js +33 -18
  64. package/dist-esm/src/credentials/managedIdentityCredential/cloudShellMsi.js.map +1 -1
  65. package/dist-esm/src/credentials/managedIdentityCredential/constants.js +2 -1
  66. package/dist-esm/src/credentials/managedIdentityCredential/constants.js.map +1 -1
  67. package/dist-esm/src/credentials/managedIdentityCredential/fabricMsi.js +42 -23
  68. package/dist-esm/src/credentials/managedIdentityCredential/fabricMsi.js.map +1 -1
  69. package/dist-esm/src/credentials/managedIdentityCredential/imdsMsi.js +108 -73
  70. package/dist-esm/src/credentials/managedIdentityCredential/imdsMsi.js.map +1 -1
  71. package/dist-esm/src/credentials/managedIdentityCredential/index.browser.js +3 -6
  72. package/dist-esm/src/credentials/managedIdentityCredential/index.browser.js.map +1 -1
  73. package/dist-esm/src/credentials/managedIdentityCredential/index.js +119 -124
  74. package/dist-esm/src/credentials/managedIdentityCredential/index.js.map +1 -1
  75. package/dist-esm/src/credentials/managedIdentityCredential/models.js.map +1 -1
  76. package/dist-esm/src/credentials/managedIdentityCredential/tokenExchangeMsi.js +82 -0
  77. package/dist-esm/src/credentials/managedIdentityCredential/tokenExchangeMsi.js.map +1 -0
  78. package/dist-esm/src/credentials/managedIdentityCredential/utils.js +14 -8
  79. package/dist-esm/src/credentials/managedIdentityCredential/utils.js.map +1 -1
  80. package/dist-esm/src/credentials/onBehalfOfCredential.browser.js +17 -0
  81. package/dist-esm/src/credentials/onBehalfOfCredential.browser.js.map +1 -0
  82. package/dist-esm/src/credentials/onBehalfOfCredential.js +62 -0
  83. package/dist-esm/src/credentials/onBehalfOfCredential.js.map +1 -0
  84. package/dist-esm/src/credentials/onBehalfOfCredentialOptions.js +4 -0
  85. package/dist-esm/src/credentials/onBehalfOfCredentialOptions.js.map +1 -0
  86. package/dist-esm/src/credentials/usernamePasswordCredential.browser.js +87 -0
  87. package/dist-esm/src/credentials/usernamePasswordCredential.browser.js.map +1 -0
  88. package/dist-esm/src/credentials/usernamePasswordCredential.js +9 -33
  89. package/dist-esm/src/credentials/usernamePasswordCredential.js.map +1 -1
  90. package/dist-esm/src/credentials/usernamePasswordCredentialOptions.js.map +1 -1
  91. package/dist-esm/src/credentials/visualStudioCodeCredential.browser.js +5 -0
  92. package/dist-esm/src/credentials/visualStudioCodeCredential.browser.js.map +1 -1
  93. package/dist-esm/src/credentials/visualStudioCodeCredential.js +70 -68
  94. package/dist-esm/src/credentials/visualStudioCodeCredential.js.map +1 -1
  95. package/dist-esm/src/credentials/visualStudioCodeCredentialPlugin.js +4 -0
  96. package/dist-esm/src/credentials/visualStudioCodeCredentialPlugin.js.map +1 -0
  97. package/dist-esm/src/index.js +6 -1
  98. package/dist-esm/src/index.js.map +1 -1
  99. package/dist-esm/src/msal/browserFlows/browserCommon.js +30 -29
  100. package/dist-esm/src/msal/browserFlows/browserCommon.js.map +1 -1
  101. package/dist-esm/src/msal/browserFlows/msalAuthCode.js +103 -113
  102. package/dist-esm/src/msal/browserFlows/msalAuthCode.js.map +1 -1
  103. package/dist-esm/src/msal/credentials.js.map +1 -1
  104. package/dist-esm/src/msal/errors.js +1 -2
  105. package/dist-esm/src/msal/errors.js.map +1 -1
  106. package/dist-esm/src/msal/flows.js.map +1 -1
  107. package/dist-esm/src/msal/nodeFlows/msalAuthorizationCode.js +41 -0
  108. package/dist-esm/src/msal/nodeFlows/msalAuthorizationCode.js.map +1 -0
  109. package/dist-esm/src/msal/nodeFlows/msalClientCertificate.js +64 -46
  110. package/dist-esm/src/msal/nodeFlows/msalClientCertificate.js.map +1 -1
  111. package/dist-esm/src/msal/nodeFlows/msalClientSecret.js +15 -16
  112. package/dist-esm/src/msal/nodeFlows/msalClientSecret.js.map +1 -1
  113. package/dist-esm/src/msal/nodeFlows/msalDeviceCode.js +20 -22
  114. package/dist-esm/src/msal/nodeFlows/msalDeviceCode.js.map +1 -1
  115. package/dist-esm/src/msal/nodeFlows/msalOnBehalfOf.js +56 -0
  116. package/dist-esm/src/msal/nodeFlows/msalOnBehalfOf.js.map +1 -0
  117. package/dist-esm/src/msal/nodeFlows/msalOpenBrowser.js +43 -32
  118. package/dist-esm/src/msal/nodeFlows/msalOpenBrowser.js.map +1 -1
  119. package/dist-esm/src/msal/nodeFlows/msalUsernamePassword.js +15 -17
  120. package/dist-esm/src/msal/nodeFlows/msalUsernamePassword.js.map +1 -1
  121. package/dist-esm/src/msal/nodeFlows/nodeCommon.js +133 -110
  122. package/dist-esm/src/msal/nodeFlows/nodeCommon.js.map +1 -1
  123. package/dist-esm/src/msal/nodeFlows/tokenCachePersistenceOptions.js +4 -0
  124. package/dist-esm/src/msal/nodeFlows/tokenCachePersistenceOptions.js.map +1 -0
  125. package/dist-esm/src/msal/utils.js +31 -22
  126. package/dist-esm/src/msal/utils.js.map +1 -1
  127. package/dist-esm/src/plugins/consumer.browser.js +7 -0
  128. package/dist-esm/src/plugins/consumer.browser.js.map +1 -0
  129. package/dist-esm/src/plugins/consumer.js +44 -0
  130. package/dist-esm/src/plugins/consumer.js.map +1 -0
  131. package/dist-esm/src/{tokenCache/types.js → plugins/provider.js} +1 -1
  132. package/dist-esm/src/plugins/provider.js.map +1 -0
  133. package/dist-esm/src/regionalAuthority.js +115 -0
  134. package/dist-esm/src/regionalAuthority.js.map +1 -0
  135. package/dist-esm/src/util/logging.js +1 -1
  136. package/dist-esm/src/util/logging.js.map +1 -1
  137. package/dist-esm/src/util/processUtils.js +32 -0
  138. package/dist-esm/src/util/processUtils.js.map +1 -0
  139. package/dist-esm/src/util/scopeUtils.js +22 -0
  140. package/dist-esm/src/util/scopeUtils.js.map +1 -0
  141. package/dist-esm/src/util/tracing.js +23 -26
  142. package/dist-esm/src/util/tracing.js.map +1 -1
  143. package/dist-esm/src/util/validateMultiTenant.js +24 -0
  144. package/dist-esm/src/util/validateMultiTenant.js.map +1 -0
  145. package/package.json +43 -41
  146. package/types/identity.d.ts +500 -131
  147. package/dist-esm/src/tokenCache/TokenCachePersistence.browser.js +0 -23
  148. package/dist-esm/src/tokenCache/TokenCachePersistence.browser.js.map +0 -1
  149. package/dist-esm/src/tokenCache/TokenCachePersistence.js +0 -51
  150. package/dist-esm/src/tokenCache/TokenCachePersistence.js.map +0 -1
  151. package/dist-esm/src/tokenCache/nodeVersion.js +0 -10
  152. package/dist-esm/src/tokenCache/nodeVersion.js.map +0 -1
  153. package/dist-esm/src/tokenCache/persistencePlatforms.js +0 -150
  154. package/dist-esm/src/tokenCache/persistencePlatforms.js.map +0 -1
  155. package/dist-esm/src/tokenCache/types.js.map +0 -1
  156. package/dist-esm/src/util/authHostEnv.js +0 -13
  157. package/dist-esm/src/util/authHostEnv.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,120 @@
1
1
  # Release History
2
2
 
3
+ ## 2.0.0-beta.6 (2021-09-09)
4
+
5
+ ### Features Added
6
+
7
+ - Added the `OnBehalfOfCredential`, which allows users to authenticate through the [On-Behalf-Of authentication flow](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-on-behalf-of-flow).
8
+ - `ManagedIdentityCredential` now supports token exchange authentication.
9
+
10
+ ### Breaking Changes
11
+
12
+ - `ClientCertificateCredential` now evaluates the validity of the PEM certificate path on `getToken` and not on the constructor.
13
+
14
+ #### Breaking Changes from 2.0.0-beta.5
15
+
16
+ - The property named `selectedCredential` that was added to `ChainedTokenCredential` and `DefaultAzureCredential` has been removed, since customers reported that logging was enough.
17
+ - Renamed the `allowUnencryptedStorage` property of `TokenCachePersistenceOptions` to `unsafeAllowUnencryptedStorage` to make it clear that enabling the unencrypted storage feature is not generally safe for production use.
18
+ - Changed the name of the "extension" API to the "plugin" API to reduce confusion between this package and VS Code extensions. The function `useIdentityExtension` was renamed to `useIdentityPlugin`, and "extension packages" are now known as "plugin packages".
19
+ - Renamed the `allowUnencryptedStorage` property of `TokenCachePersistenceOptions` to `unsafeAllowUnencryptedStorage` to make it clear that enabling the unencrypted storage feature is not generally safe for production use.
20
+
21
+ ### Bugs Fixed
22
+
23
+ - `ClientSecretCredential`, `ClientCertificateCredential` and `UsernamePasswordCredential` now throw if the required parameters are not provided (even in JavaScript).
24
+ - Fixed a bug introduced on 2.0.0-beta.5 that caused the `ManagedIdentityCredential` to fail authenticating in Arc environments. Since our new core disables unsafe requests by default, we had to change the security settings for the first request of the Arc MSI, which retrieves the file path where the authentication value is stored since this request generally happens through an HTTP endpoint.
25
+ - Fixed bug on the `AggregateAuthenticationError`, which caused an inconsistent error message on the `ChainedTokenCredential`, `DefaultAzureCredential` and `ApplicationCredential`.
26
+
27
+ ### Other Changes
28
+
29
+ - The errors thrown by the `ManagedIdentityCredential` have been improved.
30
+
31
+ ## 2.0.0-beta.5 (2021-08-10)
32
+
33
+ ### Features Added
34
+
35
+ - This release adds support by default for CP1 client capabilities, enabling all credentials to respond to claims challenges that occur due to insufficient claims. Claims challenges, for example, can occur due to requirements of [Continuous Access Enforcement (CAE)](https://docs.microsoft.com/azure/active-directory/conditional-access/concept-continuous-access-evaluation) and [Conditional Access authentication context](https://techcommunity.microsoft.com/t5/azure-active-directory-identity/granular-conditional-access-for-sensitive-data-and-actions/ba-p/1751775). You may optionally disable this behavior by setting the environment variable `AZURE_IDENTITY_DISABLE_CP1` (to any value). You can read more about client capabilities, CAE, and Conditional Access on [the Microsoft Documentation](https://docs.microsoft.com/azure/active-directory/develop/claims-challenge).
36
+ - `ChainedTokenCredential` and `DefaultAzureCredential` now expose a property named `selectedCredential`, which will store the selected credential once any of the available credentials succeeds.
37
+ - Implementation of `ApplicationCredential` for use by applications which call into Microsoft Graph APIs and which have issues using `DefaultAzureCredential`. This credential is based on `EnvironmentCredential` and `ManagedIdentityCredential`.
38
+
39
+ ### Breaking Changes
40
+
41
+ > These changes do not impact the API of stable versions such as 1.6.0.
42
+ > Only code written against a beta version such as 1.7.0b1 may be affected.
43
+
44
+ - Renamed `AZURE_POD_IDENTITY_TOKEN_URL` to `AZURE_POD_IDENTITY_AUTHORITY_HOST`.
45
+
46
+ ### Bugs Fixed
47
+
48
+ - With this release, we've migrated from using `@azure/core-http` to `@azure/core-rest-pipeline` for the handling of HTTP requests. See [Azure Core v1 vs v2](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-rest-pipeline/documentation/core2.md) for more on the difference and benefits of the move. This removes our dependency on `node-fetch` and along with it issues we have seen in using this dependency in specific environments like Kubernetes pods.
49
+
50
+ ## 1.5.2 (2021-09-01)
51
+
52
+ - Fixed a bug introduced on 1.5.0 that caused the `ManagedIdentityCredential` to fail authenticating in Arc environments. Since our new core disables unsafe requests by default, we had to change the security settings for the first request of the Arc MSI, which retrieves the file path where the authentication value is stored since this request generally happens through an HTTP endpoint.
53
+
54
+ ## 1.5.1 (2021-08-12)
55
+
56
+ - Fixed how we verify the IMDS endpoint is available. Now, besides skipping the `Metadata` header, we skip the URL query. Both will ensure that all the known IMDS endpoints return as early as possible.
57
+ - Added support for the `AZURE_POD_IDENTITY_AUTHORITY_HOST` environment variable. If present, the IMDS endpoint initial verification will be skipped.
58
+
59
+ ## 1.5.0 (2021-07-19)
60
+
61
+ - With this release, we've migrated from using `@azure/core-http` to `@azure/core-rest-pipeline` for the handling of HTTP requests. See [Azure Core v1 vs v2](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-rest-pipeline/documentation/core2.md) for more on the difference and benefits of the move. This removes our dependency on `node-fetch` and along with it issues we have seen in using this dependency in specific environments like Kubernetes pods.
62
+
63
+ ## 1.4.0 (2021-07-09)
64
+
65
+ - With this release, we drop support for Node.js versions that have reached the end of life, like Node.js 8. Read our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details.
66
+ - Updated the default timeout of the first request of the IMDS MSI from half a second to three seconds to compensate for the slowness caused by `node-fetch` for initial requests in specific environments, like Kubernetes pods.
67
+ - Upgraded `@azure/core-http` to version `^2.0.0`, and `@azure/core-tracing` to version `1.0.0-preview.12`.
68
+
69
+ - Upgraded the `AuthorizationCodeCredential` to use the latest `@azure/msal-node`.
70
+
71
+ ## 2.0.0-beta.4 (2021-07-07)
72
+
73
+ ### Features Added
74
+
75
+ - With the dropping of support for Node.js versions that are no longer in LTS, the dependency on `@types/node` has been updated to version 12. Read our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details.
76
+ - Introduced an extension API through a top-level method `useIdentityExtension`. The function accepts an "extension" as an argument, which is a function accepting a `context`. The extension context is an internal part of the Azure Identity API, so it has an `unknown` type. Two new packages are designed to be used with this API:
77
+ - `@azure/identity-vscode`, which provides the dependencies of `VisualStudioCodeCredential` and enables it (see more below).
78
+ - `@azure/identity-cache-persistence`, which provides persistent token caching (same as was available in version 2.0.0-beta.2, but now provided through a secondary extension package).
79
+ - Reintroduced a stub implementation of `VisualStudioCodeCredential`. If the `@azure/identity-vscode` extension is not used, then it will throw a `CredentialUnavailableError` (similar to how it previously behaved if the `keytar` package was not installed). The extension now provides the underlying implementation of `VisualStudioCodeCredential` through dependency injection.
80
+ - Reintroduced the `TokenCachePersistenceOptions` property on most credential constructor options. This property must be present with an `enabled` property set to true to enable persistent token caching for a credential instance. Credentials that do not support persistent token caching do not have this property.
81
+ - Added support to `ManagedIdentityCredential` for Bridge to Kubernetes local development authentication.
82
+ - Enabled PKCE on `InteractiveBrowserCredential` for Node.js. [Proof Key for Code Exchange (PKCE)](https://datatracker.ietf.org/doc/html/rfc7636) is a security feature that mitigates authentication code interception attacks.
83
+ - Added `LoginHint` property to `InteractiveBrowserCredentialOptions` which allows a user name to be pre-selected for interactive logins. Setting this option skips the account selection prompt and immediately attempts to login with the specified account.
84
+ - Added regional STS support to client credential types.
85
+ - Added the `RegionalAuthority` type, that allows specifying Azure regions.
86
+ - Added `regionalAuthority` property to `ClientSecretCredentialOptions` and `ClientCertificateCredentialOptions`.
87
+ - If instead of a region, `AutoDiscoverRegion` is specified as the value for `regionalAuthority`, MSAL will be used to attempt to discover the region.
88
+ - A region can also be specified through the `AZURE_REGIONAL_AUTHORITY_NAME` environment variable.
89
+ - `AzureCliCredential` and `AzurePowerShellCredential` now allow specifying a `tenantId`.
90
+ - All credentials except `ManagedIdentityCredential` support enabling multi tenant authentication via the `allowMultiTenantAuthentication` option.
91
+
92
+ ### Breaking Changes
93
+
94
+ - Removed the protected method `getAzureCliAccessToken` from the public API of the `AzureCliCredential`. While it will continue to be available as part of v1, we won't be supporting this method as part of v2's public API.
95
+
96
+ ### Key Bugs Fixed
97
+
98
+ - Fixed an issue in which `InteractiveBrowserCredential` on Node would sometimes cause the process to hang if there was no browser available.
99
+ - Fixed an issue in which the `AZURE_AUTHORITY_HOST` environment variable was not properly picked up in Node.js.
100
+
101
+ ## 2.0.0-beta.3 (2021-05-12)
102
+
103
+ ### New features
104
+
105
+ - Azure Identity for JavaScript no longer carries any native dependencies (neither ordinary, peer, nor optional dependencies). Previous distributions of `@azure/identity` carried an optional dependency on `keytar`, which caused issues for some users in restrictive environments.
106
+ - Updated the `@azure/msal-node` dependency to version `^1.0.2`, which allows cancelling of an ongoing `getToken()` operation on `DeviceCodeCredential`.
107
+ - Fixed issue with the logging of success messages on the `DefaultAzureCredential` and the `ChainedTokenCredential`. These messages will now mention the internal credential that succeeded.
108
+ - `AuthenticationRequiredError` (introduced in 2.0.0-beta.1) now has the same impact on `ChainedTokenCredential` as the `CredentialUnavailableError` which is to allow the next credential in the chain to be tried.
109
+ - `ManagedIdentityCredential` now retries with exponential back-off when a request for a token fails with a 404 status code on environments with available IMDS endpoints.
110
+ - Added an `AzurePowerShellCredential` which will use the authenticated user session from the `Az.Account` PowerShell module. This credential will attempt to use PowerShell Core by calling `pwsh`, and on Windows it will fall back to Windows PowerShell (`powershell`) if PowerShell Core is not available.
111
+
112
+ ### Breaking changes from 2.0.0-beta.1
113
+
114
+ - Removed `VisualStudioCodeCredential`, since it requires us to list [keytar](https://www.npmjs.com/package/keytar) as an optional dependency. `keytar` contains machine-code components that are difficult to build in certain environments, so this credential will be offered through a separate extension package in the future.
115
+ - Removed token persistence through `@azure/msal-node-extensions`, as its machine-code components have the same problems as `keytar`. This functionality will similarly be reintroduced through a separate extension package in the future.
116
+ - Removed `authenticationRecord`, `disableAutomaticAuthentication` and `authenticate()` from the credential `UsernamePasswordCredential`. While MSAL does support this, allowing `authenticationRecord` arguably could result in users authenticating through an account other than the one they're specifying with the username and the password.
117
+
3
118
  ## 2.0.0-beta.2 (2021-04-06)
4
119
 
5
120
  - Breaking change: Renamed errors `CredentialUnavailable` to `CredentialUnavailableError`, and `AuthenticationRequired` to `AuthenticationRequiredError`, to align with the naming convention used for error classes in the Azure SDKs in JavaScript.
@@ -12,14 +127,20 @@
12
127
 
13
128
  > With the plans for [third party cookies to be removed from browsers](https://docs.microsoft.com/azure/active-directory/develop/reference-third-party-cookies-spas), the **implicit grant flow is no longer a suitable authentication method**. The [silent SSO features](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-implicit-grant-flow#getting-access-tokens-silently-in-the-background) of the implicit flow do not work without third party cookies, causing applications to break when they attempt to get a new token. We strongly recommend that all new applications use the authorization code flow that now supports single page apps in place of the implicit flow, and that [existing single page apps begin migrating to the authorization code flow](https://docs.microsoft.com/azure/active-directory/develop/migrate-spa-implicit-to-auth-code) as well.
14
129
 
130
+ ## 1.3.0 (2021-04-05)
131
+
132
+ ### Tracing Changes
133
+
134
+ - Updated @azure/core-tracing to version `1.0.0-preview.11`. See [@azure/core-tracing CHANGELOG](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-tracing/CHANGELOG.md) for details about breaking changes with tracing.
135
+
15
136
  ## 2.0.0-beta.1 (2021-03-24)
16
137
 
17
138
  This update marks the preview for the first major version update of the `@azure/identity` package since the first stable version was released in October, 2019. This is mainly driven by the improvements we are making for the `InteractiveBrowserCredential` when used in browser applications by updating it to use the new `@azure/msal-browser` which is replacing the older `msal` package.
18
139
 
19
140
  ### Breaking changes
20
141
 
21
- - Changes to `InteractiveBrowserCredential`
22
- - When used in browser applications, the `InteractiveBrowserCredential` has been updated to use the [Auth Code Flow](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-auth-code-flow) with [PKCE](https://tools.ietf.org/html/rfc7636) rather than [Implicit Grant Flow](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-implicit-grant-flow) by default to better support browsers with enhanced security restrictions. Please note that this credential always used the Auth Code Flow when used in Node.js applications. Read more on this in our [docs on Interactive Browser Credential](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/interactive-browser-credential.md).
142
+ - Changes to `InteractiveBrowserCredential`
143
+ - When used in browser applications, the `InteractiveBrowserCredential` has been updated to use the [Auth Code Flow](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-auth-code-flow) with [PKCE](https://tools.ietf.org/html/rfc7636) rather than [Implicit Grant Flow](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-implicit-grant-flow) by default to better support browsers with enhanced security restrictions. Please note that this credential always used the Auth Code Flow when used in Node.js applications. Read more on this in our [docs on Interactive Browser Credential](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/interactive-browser-credential.md).
23
144
  - The default client ID used for `InteractiveBrowserCredential` was viable only in Node.js and not for the browser. Therefore, client Id is now a required parameter when constructing this credential in browser applications.
24
145
  - The `loginStyle` and `flow` options to the constructor for `InteractiveBrowserCredential` will now show up only when used in browser applications as these were never applicable to Node.js
25
146
  - Removed the `postLogoutRedirectUri` from the options to the constructor for `InteractiveBrowserCredential`. This option was not being used since we don't have a way for users to log out yet.
@@ -33,7 +154,7 @@ This update marks the preview for the first major version update of the `@azure/
33
154
  - Changes to `InteractiveBrowserCredential`, `DeviceCodeCredential`, `ClientSecretCredential`, `ClientCertificateCredential` and `UsernamePasswordCredential`:
34
155
  - Migrated to use the latest MSAL. This update improves caching of tokens, significantly reducing the number of network requests.
35
156
  - Added the feature of persistence caching of credentials. This is driven by the new `tokenCachePersistenceOptions` option available in the options you pass to the credential constructors.
36
- - For now, to use this feature, users will need to install `@azure/msal-node-extensions` [1.0.0-alpha.6](https://www.npmjs.com/package/@azure/msal-node-extensions/v/1.0.0-alpha.6) on their own. This experience will be improved in the next update.
157
+ - For now, to use this feature, users will need to install `@azure/msal-node-extensions` [1.0.0-alpha.6](https://www.npmjs.com/package/@azure/msal-node-extensions/v/1.0.0-alpha.6) on their own. This experience will be improved in the next update.
37
158
  - This feature uses DPAPI on Windows, it tries to use the Keychain on OSX and the Keyring on Linux.
38
159
  - To learn more on the usage, please refer to our docs on the `TokenCachePersistenceOptions` interface.
39
160
  - **IMPORTANT:** As part of this beta, this feature is only supported in Node 10, 12 and 14.
@@ -49,12 +170,10 @@ This update marks the preview for the first major version update of the `@azure/
49
170
  ### Other changes
50
171
 
51
172
  - Updated the `@azure/msal-node` dependency to `^1.0.0`.
52
- - `DefaultAzureCredential`'s implementation for browsers is simplified to throw the `BrowserNotSupportedError` in its constructor. Previously, we relied on getting the same error from trying to instantiate the different credentials that `DefaultAzureCredential` supports in Node.js.
173
+ - `DefaultAzureCredential`'s implementation for browsers is simplified to throw the `BrowserNotSupportedError` in its constructor. Previously, we relied on getting the same error from trying to instantiate the different credentials that `DefaultAzureCredential` supports in Node.js.
53
174
  - As before, please use only the `InteractiveBrowserCredential` in your browser applications.
54
175
  - For the `InteractiveBrowserCredential` for node, replaced the use of the `express` module with a native http server for Node, shrinking the resulting identity module considerably.
55
176
 
56
-
57
-
58
177
  ## 1.2.4 (2021-03-08)
59
178
 
60
179
  This release doesn't have the changes from `1.2.4-beta.1`.
@@ -64,11 +183,11 @@ This release doesn't have the changes from `1.2.4-beta.1`.
64
183
 
65
184
  ## 1.2.4-beta.1 (2021-02-12)
66
185
 
67
- - Breaking Change: Updated `InteractiveBrowserCredential` to use the Auth Code Flow with PKCE rather than Implicit Grant Flow by default in the browser, to better support browsers with enhanced security restrictions. A new file was added to provide more information about this credential [here](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/interactive-browser-credential.md).
186
+ - Breaking Change: Updated `InteractiveBrowserCredential` to use the Auth Code Flow with PKCE rather than Implicit Grant Flow by default in the browser, to better support browsers with enhanced security restrictions. A new file was added to provide more information about this credential [here](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/interactive-browser-credential.md).
68
187
 
69
188
  ## 1.2.3 (2021-02-09)
70
189
 
71
- - Fixed Azure Stack support for the NodeJS version of the `InteractiveBrowserCredential`. Fixes issue [11220](https://github.com/Azure/azure-sdk-for-js/issues/11220).
190
+ - Fixed Azure Stack support for the Node.js version of the `InteractiveBrowserCredential`. Fixes issue [11220](https://github.com/Azure/azure-sdk-for-js/issues/11220).
72
191
  - The 'keytar' dependency has been updated to the latest version.
73
192
  - No longer overrides global Axios defaults. This includes an update in `@azure/identity`'s source, and an update of the `@azure/msal-node` dependency. Fixes issue [13343](https://github.com/Azure/azure-sdk-for-js/issues/13343).
74
193
 
package/README.md CHANGED
@@ -1,13 +1,28 @@
1
1
  ## Azure Identity client library for JavaScript
2
2
 
3
- The Azure Identity library provides Azure Active Directory token authentication support across the Azure SDK. It provides a set of [TokenCredential](https://docs.microsoft.com/javascript/api/@azure/core-auth/tokencredential) implementations which can be used to construct Azure SDK clients which support AAD token authentication.
3
+ The Azure Identity library provides [Azure Active Directory (AAD)](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. It enables Azure SDK clients to authenticate with AAD, while also allowing other JavaScript and TypeScript apps to authenticate with AAD work and school accounts, Microsoft personal accounts (MSA), and other Identity providers through the [AAD B2C](https://docs.microsoft.com/azure/active-directory-b2c/overview) service.
4
4
 
5
- You can find examples for these various credentials in the [Azure Identity Examples Page](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md)
5
+ You can find examples for these various credentials in the [Azure Identity Examples Page](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md)
6
6
 
7
- [Source code](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/identity/identity) | [Package (npm)](https://www.npmjs.com/package/@azure/identity) | [API Reference Documentation](https://docs.microsoft.com/javascript/api/@azure/identity) | [Product documentation](https://azure.microsoft.com/services/active-directory/) | [Samples](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples)
7
+ Key links:
8
+
9
+ - [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity)
10
+ - [Package (npm)](https://www.npmjs.com/package/@azure/identity)
11
+ - [API Reference Documentation](https://docs.microsoft.com/javascript/api/@azure/identity)
12
+ - [Product documentation](https://azure.microsoft.com/services/active-directory/)
13
+ - [Samples](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples)
8
14
 
9
15
  ## Getting started
10
16
 
17
+ ### Currently supported environments
18
+
19
+ - [LTS versions of Node.js](https://nodejs.org/about/releases/)
20
+ - **Note:** If your application runs on Node.js v8 or lower and you cannot upgrade your Node.js version to latest stable version, then pin your `@azure/identity` dependency to version 1.1.0.
21
+ - Latest versions of Safari, Chrome, Edge, and Firefox.
22
+ - **Note**: Among the different credentials exported in this library, `InteractiveBrowserCredential` is the only one that is supported in the browser.
23
+
24
+ See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details.
25
+
11
26
  ### Install the package
12
27
 
13
28
  Install Azure Identity with `npm`:
@@ -18,27 +33,36 @@ npm install --save @azure/identity
18
33
 
19
34
  ### Prerequisites
20
35
 
21
- - Node.js 8 LTS or higher.
22
36
  - An [Azure subscription](https://azure.microsoft.com/free/).
23
- - The [Azure CLI][azure_cli] can also be useful for authenticating in a development environment and managing account roles.
37
+ - Optional: The [Azure CLI][azure_cli] and/or [Azure PowerShell][azure_powershell] can also be useful for authenticating in a development environment and managing account roles.
24
38
 
25
- Credentials `InteractiveBrowserCredential`, `DeviceCodeCredential`, `ClientSecretCredential`, `ClientCertificateCredential` and `UsernamePasswordCredential` allow specifying `tokenCachePersistenceOptions` to enable persistent caching. To use this feature, developers will also need to install [@azure/msal-node-extensions](https://www.npmjs.com/package/@azure/msal-node-extensions).
39
+ ### When to use @azure/identity
26
40
 
27
- ### Authenticate the client in development environment
41
+ The credential classes exposed by `@azure/identity` are focused on providing the most straightforward way to authenticate the Azure SDK clients locally, in your development environments, and in production. We aim for simplicity and reasonable support of the authentication protocols to cover most of the authentication scenarios possible on Azure. We're actively expanding to cover more scenarios. For a full list of the credentials offered, see the [Credential Classes](#credential-classes) section.
28
42
 
29
- While we recommend using managed identity or service principal authentication in your production application, it is typical for a developer to use their own account for authenticating calls to Azure services when debugging and executing code locally. There are several developer tools which can be used to perform this authentication in your development environment.
43
+ All credential types provided by `@azure/identity` are supported in Node.js. For browsers, `InteractiveBrowserCredential` is the credential type to be used for basic authentication scenarios.
44
+
45
+ Most of the credential types offered by `@azure/identity` use the [Microsoft Authentication Library for JavaScript (MSAL.js)](https://github.com/AzureAD/microsoft-authentication-library-for-js). Specifically, we use the v2 MSAL.js libraries, which use [OAuth 2.0 Authorization Code Flow with PKCE](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-auth-code-flow) and are [OpenID-compliant](https://docs.microsoft.com/azure/active-directory/develop/v2-protocols-oidc). While `@azure/identity` focuses on simplicity, the MSAL.js libraries, such as [@azure/msal-common](https://www.npmjs.com/package/@azure/msal-common), [@azure/msal-node](https://www.npmjs.com/package/@azure/msal-node), and [@azure/msal-browser](https://www.npmjs.com/package/@azure/msal-browser), are designed to provide robust support for the authentication protocols that Azure supports.
46
+
47
+ #### When to use something else
48
+
49
+ The `@azure/identity` credential types are implementations of [@azure/core-auth](https://www.npmjs.com/package/@azure/core-auth)'s `TokenCredential` class. In principle, any object with a `getToken` method that satisfies `getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken | null>` will work as a `TokenCredential`. This means developers can write their own credential types to support authentication cases not covered by `@azure/identity`. To learn more, see [Custom Credentials](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#custom-credentials).
50
+
51
+ Though our credential types support many advanced cases, developers may want full control of the authentication protocol. For that use case, we recommend using [Microsoft Authentication Library for JavaScript (MSAL.js)](https://github.com/AzureAD/microsoft-authentication-library-for-js) directly. You can read more through the following links:
30
52
 
31
- #### Authenticating via Visual Studio Code
53
+ - We portray some advanced use cases of `@azure/identity` on the [Azure Identity Examples](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md) page.
54
+ - There, we specifically have an [Advanced Examples](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#advanced-examples) section.
55
+ - We also have a section that shows how to [Authenticate with MSAL directly](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-msal-directly).
32
56
 
33
- 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. Applications using the `DefaultAzureCredential` or the `VisualStudioCodeCredential` can then use this account to authenticate calls in their application when running locally.
57
+ For advanced authentication workflows in the browser, we have a section where we showcase how to use the [@azure/msal-browser](https://www.npmjs.com/package/@azure/msal-browser) library directly to authenticate Azure SDK clients.
34
58
 
35
- To authenticate in Visual Studio Code, first ensure the [Azure Account Extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.azure-account) is installed. Once the extension is installed, press `F1` to open the command palette and run the `Azure: Sign In` command.
59
+ ### Authenticate the client in development environment
36
60
 
37
- ![Visual Studio Code Account Sign In][vscodelogincommand_image]
61
+ While we recommend using managed identity or service principal authentication in your production application, it is typical for a developer to use their own account for authenticating calls to Azure services when debugging and executing code locally. There are several developer tools which can be used to perform this authentication in your development environment.
38
62
 
39
63
  #### Authenticating via the Azure CLI
40
64
 
41
- Applications using the `AzureCliCredential`, rather directly or via the `DefaultAzureCredential`, can use the Azure CLI account to authenticate calls in the application when running locally.
65
+ Applications using the `AzureCliCredential`, whether directly or via the `DefaultAzureCredential`, can use the Azure CLI account to authenticate calls in the application when running locally.
42
66
 
43
67
  To authenticate with the [Azure CLI][azure_cli] users can run the command `az login`. For users running on a system with a default web browser the Azure cli will launch the browser to authenticate the user.
44
68
 
@@ -48,19 +72,29 @@ For systems without a default web browser, the `az login` command will use the d
48
72
 
49
73
  ![Azure CLI Account Device Code Sign In][azureclilogindevicecode_image]
50
74
 
75
+ #### Authenticating via Azure PowerShell
76
+
77
+ Applications using the `AzurePowerShellCredential`, whether directly or via the `DefaultAzureCredential`, can use the account connected to Azure PowerShell to authenticate calls in the application when running locally.
78
+
79
+ To authenticate with [Azure PowerShell][azure_powershell] users can run the `Connect-AzAccount` cmdlet. By default, ike the Azure CLI, `Connect-AzAccount` will launch the default web browser to authenticate a user account.
80
+
81
+ ![Azure PowerShell Account Sign In][azurepowershelllogin_image]
82
+
83
+ If interactive authentication cannot be supported in the session, then the `-UseDeviceAuthentication` argument will force the cmdlet to use a device code authentication flow instead, similar to the corresponding option in the Azure CLI credential.
84
+
51
85
  ### Authenticate the client in browsers
52
86
 
53
87
  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.
54
88
 
55
89
  ## Key concepts
56
90
 
57
- If this is your first time using `@azure/identity` or the Microsoft identity platform (Azure Active Directory), we recommend that you read [Using `@azure/identity` with Microsoft Identity Platform](https://github.com/Azure/azure-sdk-for-js/blob/master/documentation/using-azure-identity.md) first. This document will give you a deeper understanding of the platform and how to configure your Azure account correctly.
91
+ If this is your first time using `@azure/identity` or the Microsoft identity platform (Azure Active Directory), we recommend that you read [Using `@azure/identity` with Microsoft Identity Platform](https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/using-azure-identity.md) first. This document will give you a deeper understanding of the platform and how to configure your Azure account correctly.
58
92
 
59
93
  ### Credentials
60
94
 
61
95
  A credential is a class which contains or can obtain the data needed for a service client to authenticate requests. Service clients across Azure SDK accept credentials when they are constructed, and service clients use those credentials to authenticate requests to the service.
62
96
 
63
- The Azure Identity library focuses on OAuth authentication with Azure Active directory, and it offers a variety of credential classes capable of acquiring an AAD token to authenticate service requests. All of the credential classes in this library are implementations of the [TokenCredential](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/core/core-auth/src/tokenCredential.ts) abstract class, and any of them can be used by to construct service clients capable of authenticating with a TokenCredential.
97
+ The Azure Identity library focuses on OAuth authentication with Azure Active directory, and it offers a variety of credential classes capable of acquiring an AAD token to authenticate service requests. All of the credential classes in this library are implementations of the [TokenCredential](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-auth/src/tokenCredential.ts) abstract class, and any of them can be used by to construct service clients capable of authenticating with a TokenCredential.
64
98
 
65
99
  See [Credential Classes](#credential-classes).
66
100
 
@@ -70,14 +104,22 @@ The `DefaultAzureCredential` is appropriate for most scenarios where the applica
70
104
 
71
105
  > Note: `DefaultAzureCredential` is intended to simplify getting started with the SDK by handling common scenarios with reasonable default behaviors. Developers who want more control or whose scenario isn't served by the default settings should use other credential types.
72
106
 
73
- If used from NodeJS, the `DefaultAzureCredential` will attempt to authenticate via the following mechanisms in order:
107
+ If used from Node.js, the `DefaultAzureCredential` will attempt to authenticate via the following mechanisms in order:
74
108
 
75
109
  ![DefaultAzureCredential authentication flow][defaultauthflow_image]
76
110
 
77
111
  - Environment - The `DefaultAzureCredential` will read account information specified via [environment variables](#environment-variables) and use it to authenticate.
78
112
  - Managed Identity - If the application is deployed to an Azure host with Managed Identity enabled, the `DefaultAzureCredential` will authenticate with that account.
79
- - Visual Studio Code - If the developer has authenticated via the Visual Studio Code Azure Account plugin, the `DefaultAzureCredential` will authenticate with that account.
113
+ - 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.
80
114
  - Azure CLI - If the developer has authenticated an account via the Azure CLI `az login` command, the `DefaultAzureCredential` will authenticate with that account.
115
+ - Azure PowerShell - If the developer has authenticated using the Azure PowerShell module `Connect-AzAccount` command, the `DefaultAzureCredential` will authenticate with that account.
116
+
117
+ ## Plugins
118
+
119
+ Azure Identity for JavaScript provides a plugin API that allows us to provide certain functionality through separate _plugin packages_. The `@azure/identity` package exports a top-level function (`useIdentityPlugin`) that can be used to enable a plugin. We provide two plugin packages:
120
+
121
+ - [`@azure/identity-cache-persistence`](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity-cache-persistence), which provides persistent token caching in Node.js using a native secure storage system provided by your operating system. This plugin allows cached `access_token` values to persist across sessions, meaning that an interactive login flow does not need to be repeated as long as a cached token is available.
122
+ - [`@azure/identity-vscode`](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity-vscode), which provides the dependencies of `VisualStudioCodeCredential` and enables it. Without this plugin, the `VisualStudioCodeCredential` in this package will throw a `CredentialUnavailableError`. The plugin provides the underlying implementation of this credential, enabling it for use both on its own and as part of the `DefaultAzureCredential` described above.
81
123
 
82
124
  ## Environment Variables
83
125
 
@@ -111,7 +153,7 @@ Configuration is attempted in the above order. For example, if values for a clie
111
153
 
112
154
  ## Examples
113
155
 
114
- You can find more examples of using various credentials in [Azure Identity Examples Page](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md)
156
+ You can find more examples of using various credentials in [Azure Identity Examples Page](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md)
115
157
 
116
158
  ### Authenticating with the `DefaultAzureCredential`
117
159
 
@@ -136,7 +178,7 @@ const client = new KeyClient(vaultUrl, credential);
136
178
 
137
179
  ### Specifying a user assigned managed identity with the `DefaultAzureCredential`
138
180
 
139
- A relatively common scenario involves authenticating using a user assigned managed identity for an Azure resource. Explore the [example on Authenticating a user assigned managed identity with DefaultAzureCredential](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-user-assigned-managed-identity-with-defaultazurecredential) to see how this is made a relatively straightforward task that can be configured using environment variables or in code.
181
+ A relatively common scenario involves authenticating using a user assigned managed identity for an Azure resource. Explore the [example on Authenticating a user assigned managed identity with DefaultAzureCredential](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-user-assigned-managed-identity-with-defaultazurecredential) to see how this is made a relatively straightforward task that can be configured using environment variables or in code.
140
182
 
141
183
  ### Define a custom authentication flow with the `ChainedTokenCredential`
142
184
 
@@ -167,41 +209,41 @@ The [Managed identity authentication](https://docs.microsoft.com/azure/active-di
167
209
  - [Azure Arc](https://docs.microsoft.com/azure/azure-arc/servers/managed-identity-authentication)
168
210
  - [Azure Service Fabric](https://docs.microsoft.com/azure/service-fabric/concepts-managed-identity)
169
211
 
170
- For examples of how to use managed identity for authentication please refer to [the examples](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-in-azure-with-managed-identity)
212
+ For examples of how to use managed identity for authentication please refer to [the examples](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-in-azure-with-managed-identity)
171
213
 
172
214
  ## Credential Classes
173
215
 
174
216
  ### Authenticating Azure Hosted Applications
175
217
 
176
- | credential | usage | example |
177
- | --------------------------- | ---------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
178
- | `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/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-defaultazurecredential) |
179
- | `ChainedTokenCredential` | Allows users to define custom authentication flows composing multiple credentials. | [example](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#chaining-credentials) |
180
- | `EnvironmentCredential` | Authenticates a service principal or user via credential information specified in environment variables. | [example](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-service-principal-with-environment-credentials) |
181
- | `ManagedIdentityCredential` | Authenticates the managed identity of an Azure resource. | [example](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-in-azure-with-managed-identity) |
218
+ | credential | usage | example |
219
+ | --------------------------- | ---------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
220
+ | `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) |
221
+ | `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) |
222
+ | `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) |
223
+ | `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) |
182
224
 
183
225
  ### Authenticating Service Principals
184
226
 
185
- | credential | usage | example | reference |
186
- | ----------------------------- | ------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------- |
187
- | `ClientSecretCredential` | Authenticates a service principal using a secret. | [example](https://github.com/Azure/azure-sdk-for-js/blob/master/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) |
188
- | `ClientCertificateCredential` | Authenticates a service principal using a certificate. | [example](https://github.com/Azure/azure-sdk-for-js/blob/master/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) |
227
+ | credential | usage | example | reference |
228
+ | ----------------------------- | ------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
229
+ | `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) |
230
+ | `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) |
189
231
 
190
232
  ### Authenticating Users
191
233
 
192
- | credential | usage | example | reference |
193
- | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
194
- | `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/master/sdk/identity/identity/interactive-browser-credential.md). | [example](https://github.com/Azure/azure-sdk-for-js/blob/master/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) |
195
- | `DeviceCodeCredential` | Interactively authenticates a user on devices with limited UI. | [example](https://github.com/Azure/azure-sdk-for-js/blob/master/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) |
196
- | `UserPasswordCredential` | Authenticates a user with a username and password. | [example](https://github.com/Azure/azure-sdk-for-js/blob/master/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) |
197
- | `AuthorizationCodeCredential` | Authenticate a user with a previously obtained authorization code. | [example](https://github.com/Azure/azure-sdk-for-js/blob/master/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) |
234
+ | credential | usage | example | reference |
235
+ | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
236
+ | `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) |
237
+ | `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) |
238
+ | `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) |
239
+ | `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) |
198
240
 
199
241
  ### Authenticating via Development Tools
200
242
 
201
- | credential | usage | example | reference |
202
- | ---------------------------- | ------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
203
- | `AzureCliCredential` | Authenticate in a development environment with the Azure CLI. | [example](https://github.com/Azure/azure-sdk-for-js/blob/master/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) |
204
- | `VisualStudioCodeCredential` | Authenticate in a development environment with Visual Studio Code. | [example](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-user-account-with-visual-studio-code) | [VS Code Azure extension](https://code.visualstudio.com/docs/azure/extensions) |
243
+ | credential | usage | example | reference |
244
+ | --------------------------- | ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
245
+ | `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) |
246
+ | `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) |
205
247
 
206
248
  ## Troubleshooting
207
249
 
@@ -231,7 +273,7 @@ If you encounter bugs or have suggestions, please [open an issue](https://github
231
273
 
232
274
  ## Contributing
233
275
 
234
- If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/master/CONTRIBUTING.md) to learn more about how to build and test the code.
276
+ If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code.
235
277
 
236
278
  [1]: https://azuresdkdocs.blob.core.windows.net/$web/javascript/azure-identity/1.0.0/classes/defaultazurecredential.html
237
279
  [2]: https://azuresdkdocs.blob.core.windows.net/$web/javascript/azure-identity/1.0.0/classes/managedidentitycredential.html
@@ -243,9 +285,10 @@ If you'd like to contribute to this library, please read the [contributing guide
243
285
  [8]: https://azuresdkdocs.blob.core.windows.net/$web/javascript/azure-identity/1.0.0/classes/interactivebrowsercredential.html
244
286
  [9]: https://azuresdkdocs.blob.core.windows.net/$web/javascript/azure-identity/1.0.0/classes/usernamepasswordcredential.html
245
287
  [azure_cli]: https://docs.microsoft.com/cli/azure
246
- [vscodelogincommand_image]: https://raw.githubusercontent.com/Azure/azure-sdk-for-js/master/sdk/identity/identity/images/VsCodeLoginCommand.png
247
- [azureclilogin_image]: https://raw.githubusercontent.com/Azure/azure-sdk-for-js/master/sdk/identity/identity/images/AzureCliLogin.png
248
- [azureclilogindevicecode_image]: https://raw.githubusercontent.com/Azure/azure-sdk-for-js/master/sdk/identity/identity/images/AzureCliLoginDeviceCode.png
249
- [defaultauthflow_image]: https://raw.githubusercontent.com/Azure/azure-sdk-for-js/master/sdk/identity/identity/images/DefaultAzureCredentialAuthenticationFlow.png
288
+ [azure_powershell]: https://docs.microsoft.com/powershell/azure/
289
+ [azureclilogin_image]: https://raw.githubusercontent.com/Azure/azure-sdk-for-js/main/sdk/identity/identity/images/AzureCliLogin.png
290
+ [azureclilogindevicecode_image]: https://raw.githubusercontent.com/Azure/azure-sdk-for-js/main/sdk/identity/identity/images/AzureCliLoginDeviceCode.png
291
+ [azurepowershelllogin_image]: https://raw.githubusercontent.com/Azure/azure-sdk-for-js/main/sdk/identity/identity/images/AzurePowerShellLogin.png
292
+ [defaultauthflow_image]: https://raw.githubusercontent.com/Azure/azure-sdk-for-js/main/sdk/identity/identity/images/DefaultAzureCredentialAuthenticationFlow.png
250
293
 
251
294
  ![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fidentity%2Fidentity%2FREADME.png)