@azure/identity 2.0.0-beta.4 → 2.0.1-alpha.20211025.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of @azure/identity might be problematic. Click here for more details.
- package/CHANGELOG.md +215 -4
- package/README.md +78 -25
- package/dist/index.js +888 -477
- package/dist/index.js.map +1 -1
- package/dist-esm/src/client/identityClient.js +75 -62
- package/dist-esm/src/client/identityClient.js.map +1 -1
- package/dist-esm/src/credentials/authorizationCodeCredential.browser.js +1 -1
- package/dist-esm/src/credentials/authorizationCodeCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/authorizationCodeCredential.js +12 -74
- package/dist-esm/src/credentials/authorizationCodeCredential.js.map +1 -1
- package/dist-esm/src/credentials/azureApplicationCredential.browser.js +34 -0
- package/dist-esm/src/credentials/azureApplicationCredential.browser.js.map +1 -0
- package/dist-esm/src/credentials/azureApplicationCredential.js +36 -0
- package/dist-esm/src/credentials/azureApplicationCredential.js.map +1 -0
- package/dist-esm/src/credentials/azureCliCredential.browser.js +7 -0
- package/dist-esm/src/credentials/azureCliCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/azureCliCredential.js +10 -10
- package/dist-esm/src/credentials/azureCliCredential.js.map +1 -1
- package/dist-esm/src/credentials/azurePowerShellCredential.browser.js +3 -1
- package/dist-esm/src/credentials/azurePowerShellCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/azurePowerShellCredential.js +13 -13
- package/dist-esm/src/credentials/azurePowerShellCredential.js.map +1 -1
- package/dist-esm/src/credentials/chainedTokenCredential.js +3 -3
- package/dist-esm/src/credentials/chainedTokenCredential.js.map +1 -1
- package/dist-esm/src/credentials/clientCertificateCredential.browser.js +7 -0
- package/dist-esm/src/credentials/clientCertificateCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/clientCertificateCredential.js +19 -13
- package/dist-esm/src/credentials/clientCertificateCredential.js.map +1 -1
- package/dist-esm/src/credentials/clientCertificateCredentialOptions.js.map +1 -1
- package/dist-esm/src/credentials/clientSecretCredential.browser.js +17 -19
- package/dist-esm/src/credentials/clientSecretCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/clientSecretCredential.js +3 -0
- package/dist-esm/src/credentials/clientSecretCredential.js.map +1 -1
- package/dist-esm/src/credentials/clientSecretCredentialOptions.js.map +1 -1
- package/dist-esm/src/credentials/credentialPersistenceOptions.js.map +1 -1
- package/dist-esm/src/credentials/defaultAzureCredential.browser.js +1 -1
- package/dist-esm/src/credentials/defaultAzureCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/defaultAzureCredential.js +22 -21
- package/dist-esm/src/credentials/defaultAzureCredential.js.map +1 -1
- package/dist-esm/src/credentials/deviceCodeCredential.browser.js +7 -0
- package/dist-esm/src/credentials/deviceCodeCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/deviceCodeCredential.js +14 -0
- package/dist-esm/src/credentials/deviceCodeCredential.js.map +1 -1
- package/dist-esm/src/credentials/deviceCodeCredentialOptions.js.map +1 -1
- package/dist-esm/src/credentials/environmentCredential.browser.js +7 -0
- package/dist-esm/src/credentials/environmentCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/environmentCredential.js +5 -21
- package/dist-esm/src/credentials/environmentCredential.js.map +1 -1
- package/dist-esm/src/credentials/interactiveBrowserCredential.browser.js +7 -7
- package/dist-esm/src/credentials/interactiveBrowserCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/interactiveBrowserCredential.js +7 -7
- package/dist-esm/src/credentials/interactiveBrowserCredential.js.map +1 -1
- package/dist-esm/src/credentials/interactiveBrowserCredentialOptions.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/appServiceMsi2017.js +31 -12
- package/dist-esm/src/credentials/managedIdentityCredential/appServiceMsi2017.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/arcMsi.js +45 -23
- package/dist-esm/src/credentials/managedIdentityCredential/arcMsi.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/cloudShellMsi.js +29 -13
- package/dist-esm/src/credentials/managedIdentityCredential/cloudShellMsi.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/constants.js +2 -1
- package/dist-esm/src/credentials/managedIdentityCredential/constants.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/fabricMsi.js +36 -11
- package/dist-esm/src/credentials/managedIdentityCredential/fabricMsi.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/imdsMsi.js +69 -47
- package/dist-esm/src/credentials/managedIdentityCredential/imdsMsi.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/index.js +19 -17
- package/dist-esm/src/credentials/managedIdentityCredential/index.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/models.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/tokenExchangeMsi.js +82 -0
- package/dist-esm/src/credentials/managedIdentityCredential/tokenExchangeMsi.js.map +1 -0
- package/dist-esm/src/credentials/managedIdentityCredential/utils.js +16 -4
- package/dist-esm/src/credentials/managedIdentityCredential/utils.js.map +1 -1
- package/dist-esm/src/credentials/onBehalfOfCredential.browser.js +23 -0
- package/dist-esm/src/credentials/onBehalfOfCredential.browser.js.map +1 -0
- package/dist-esm/src/credentials/onBehalfOfCredential.js +57 -0
- package/dist-esm/src/credentials/onBehalfOfCredential.js.map +1 -0
- package/dist-esm/src/credentials/{visualStudioCodeCredentialExtension.js → onBehalfOfCredentialOptions.js} +1 -1
- package/dist-esm/src/credentials/onBehalfOfCredentialOptions.js.map +1 -0
- package/dist-esm/src/credentials/usernamePasswordCredential.browser.js +17 -19
- package/dist-esm/src/credentials/usernamePasswordCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/usernamePasswordCredential.js +3 -2
- package/dist-esm/src/credentials/usernamePasswordCredential.js.map +1 -1
- package/dist-esm/src/credentials/visualStudioCodeCredential.browser.js +7 -1
- package/dist-esm/src/credentials/visualStudioCodeCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/visualStudioCodeCredential.js +16 -8
- package/dist-esm/src/credentials/visualStudioCodeCredential.js.map +1 -1
- package/dist-esm/src/credentials/visualStudioCodeCredentialPlugin.js +4 -0
- package/dist-esm/src/credentials/visualStudioCodeCredentialPlugin.js.map +1 -0
- package/dist-esm/src/{client/errors.js → errors.js} +16 -1
- package/dist-esm/src/errors.js.map +1 -0
- package/dist-esm/src/index.js +3 -4
- package/dist-esm/src/index.js.map +1 -1
- package/dist-esm/src/msal/browserFlows/browserCommon.js +8 -7
- package/dist-esm/src/msal/browserFlows/browserCommon.js.map +1 -1
- package/dist-esm/src/msal/browserFlows/msalAuthCode.js +12 -4
- package/dist-esm/src/msal/browserFlows/msalAuthCode.js.map +1 -1
- package/dist-esm/src/msal/nodeFlows/msalAuthorizationCode.js +41 -0
- package/dist-esm/src/msal/nodeFlows/msalAuthorizationCode.js.map +1 -0
- package/dist-esm/src/msal/nodeFlows/msalClientCertificate.js +49 -29
- package/dist-esm/src/msal/nodeFlows/msalClientCertificate.js.map +1 -1
- package/dist-esm/src/msal/nodeFlows/msalClientSecret.js.map +1 -1
- package/dist-esm/src/msal/nodeFlows/msalOnBehalfOf.js +56 -0
- package/dist-esm/src/msal/nodeFlows/msalOnBehalfOf.js.map +1 -0
- package/dist-esm/src/msal/nodeFlows/msalOpenBrowser.js +2 -2
- package/dist-esm/src/msal/nodeFlows/msalOpenBrowser.js.map +1 -1
- package/dist-esm/src/msal/nodeFlows/nodeCommon.js +32 -13
- package/dist-esm/src/msal/nodeFlows/nodeCommon.js.map +1 -1
- package/dist-esm/src/msal/nodeFlows/tokenCachePersistenceOptions.js.map +1 -1
- package/dist-esm/src/msal/utils.js +15 -8
- package/dist-esm/src/msal/utils.js.map +1 -1
- package/dist-esm/src/plugins/consumer.browser.js +7 -0
- package/dist-esm/src/plugins/consumer.browser.js.map +1 -0
- package/dist-esm/src/{extensions → plugins}/consumer.js +12 -12
- package/dist-esm/src/plugins/consumer.js.map +1 -0
- package/dist-esm/src/{extensions → plugins}/provider.js +0 -0
- package/dist-esm/src/plugins/provider.js.map +1 -0
- package/dist-esm/src/util/tracing.js +2 -2
- package/dist-esm/src/util/tracing.js.map +1 -1
- package/dist-esm/src/util/validateMultiTenant.browser.js +22 -0
- package/dist-esm/src/util/validateMultiTenant.browser.js.map +1 -0
- package/dist-esm/src/util/validateMultiTenant.js +17 -12
- package/dist-esm/src/util/validateMultiTenant.js.map +1 -1
- package/package.json +38 -21
- package/types/identity.d.ts +250 -225
- package/dist-esm/src/client/errors.js.map +0 -1
- package/dist-esm/src/credentials/visualStudioCodeCredentialExtension.js.map +0 -1
- package/dist-esm/src/extensions/consumer.browser.js +0 -7
- package/dist-esm/src/extensions/consumer.browser.js.map +0 -1
- package/dist-esm/src/extensions/consumer.js.map +0 -1
- package/dist-esm/src/extensions/provider.js.map +0 -1
- package/dist-esm/src/msal/errors.js +0 -22
- package/dist-esm/src/msal/errors.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,219 @@
|
|
|
1
1
|
# Release History
|
|
2
2
|
|
|
3
|
+
## 2.0.1 (Unreleased)
|
|
4
|
+
|
|
5
|
+
### Features Added
|
|
6
|
+
|
|
7
|
+
- The `ManagedIdentityCredential` now supports the Service Fabric environment.
|
|
8
|
+
|
|
9
|
+
### Breaking Changes
|
|
10
|
+
|
|
11
|
+
### Bugs Fixed
|
|
12
|
+
|
|
13
|
+
- Fixed a bug that caused the `AzureCliCredential` to fail on Windows. Issue [18268](https://github.com/Azure/azure-sdk-for-js/issues/18268).
|
|
14
|
+
|
|
15
|
+
### Other Changes
|
|
16
|
+
|
|
17
|
+
## 2.0.0 (2021-10-15)
|
|
18
|
+
|
|
19
|
+
After multiple beta releases over the past year, we're proud to announce the general availability of version 2 of the `@azure/identity` package. This version includes the best parts of v1, plus several improvements.
|
|
20
|
+
|
|
21
|
+
This changelog entry showcases the changes that have been made from version 1 of this package. See the [v1-to-v2 migration guide](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/migration-v1-v2.md) for details on how to upgrade your application to use the version 2 of `@azure/identity`. For information on troubleshooting the Identity package, see the [troubleshooting guide](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/Troubleshooting.md).
|
|
22
|
+
|
|
23
|
+
### Features Added
|
|
24
|
+
|
|
25
|
+
#### Plugin API
|
|
26
|
+
|
|
27
|
+
Identity v2 provides a top-level `useIdentityPlugin` function, which allows using two new plugin packages:
|
|
28
|
+
|
|
29
|
+
- [@azure/identity-vscode](https://www.npmjs.com/package/@azure/identity-vscode), which provides the dependencies of `VisualStudioCodeCredential` and enables it.
|
|
30
|
+
- If the `@azure/identity-vscode` plugin isn't used through the `useIdentityPlugin` function, the `VisualStudioCodeCredential` exposed by Identity v2 will throw a `CredentialUnavailableError`.
|
|
31
|
+
- [@azure/identity-cache-persistence](https://www.npmjs.com/package/@azure/identity-cache-persistence), which provides persistent token caching.
|
|
32
|
+
|
|
33
|
+
Most credentials on Identity v2 now support the persistent token caching feature. Such credentials include the property [tokenCachePersistenceOptions](https://docs.microsoft.com/javascript/api/@azure/identity/tokencachepersistenceoptions) in the constructor options which can be used to enable this feature.
|
|
34
|
+
|
|
35
|
+
The following example showcases how to enable persistence caching by first enabling the `@azure/identity-cache-persistence` plugin with `useIdentityPlugin(cachePersistencePlugin)`, and then passing the `tokenCachePersistenceOptions` through the constructor of the `DeviceCodeCredential`:
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import { cachePersistencePlugin } from "@azure/identity-cache-persistence";
|
|
39
|
+
import { useIdentityPlugin, DeviceCodeCredential } from "@azure/identity";
|
|
40
|
+
|
|
41
|
+
useIdentityPlugin(cachePersistencePlugin);
|
|
42
|
+
|
|
43
|
+
async function main() {
|
|
44
|
+
const credential = new DeviceCodeCredential({
|
|
45
|
+
tokenCachePersistenceOptions: {
|
|
46
|
+
enabled: true
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
#### New credentials
|
|
53
|
+
|
|
54
|
+
Identity v2 includes two new credential types:
|
|
55
|
+
|
|
56
|
+
- `AzurePowerShellCredential`, which re-uses any account previously authenticated with the `Az.Account` PowerShell module.
|
|
57
|
+
- `OnBehalfOfCredential`, which enables the [On-Behalf-Of authentication flow](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-on-behalf-of-flow).
|
|
58
|
+
|
|
59
|
+
#### New features in all credentials
|
|
60
|
+
|
|
61
|
+
Identity v2 enables:
|
|
62
|
+
|
|
63
|
+
- Support for claims challenges resulting from [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).
|
|
64
|
+
- By default, credentials of Identity v2 will produce tokens that can be used to trigger the challenge authentication flows. After these tokens expire, the next HTTP requests to Azure will fail, but the response will contain information to re-authenticate.
|
|
65
|
+
- To disable this behavior, set the environment variable `AZURE_IDENTITY_DISABLE_CP1` to any value. For more about claims challenges, see [Claims challenges, claims requests, and client capabilities](https://docs.microsoft.com/azure/active-directory/develop/claims-challenge).
|
|
66
|
+
- Support for multi-tenant authentication on all credentials except `ManagedIdentityCredential`.
|
|
67
|
+
- At the moment, applications needing multi-tenancy support will need to call to the credentials' `getToken` directly, sending the new `tenantId` property.
|
|
68
|
+
- A sample with more context will be provided in a future date.
|
|
69
|
+
- To disable it, set the environment variable `AZURE_IDENTITY_DISABLE_MULTITENANTAUTH`. For more about multitenancy, see [Identity management in multitenant apps](https://docs.microsoft.com/azure/architecture/multitenant-identity/).
|
|
70
|
+
|
|
71
|
+
#### New features in InteractiveBrowserCredential and DeviceCodeCredential
|
|
72
|
+
|
|
73
|
+
You can now control when the credential requests user input with the new `disableAutomaticAuthentication` option added to the options you pass to the credential constructors.
|
|
74
|
+
|
|
75
|
+
- When enabled, this option stops the `getToken()` method from requesting user input in case the credential is unable to authenticate silently.
|
|
76
|
+
- If `getToken()` fails to authenticate without user interaction, and `disableAutomaticAuthentication` has been set to true, a new error will be thrown: `AuthenticationRequired`. You may use this error to identify scenarios when manual authentication needs to be triggered (with `authenticate()`, as described in the next point).
|
|
77
|
+
|
|
78
|
+
A new method `authenticate()` is added to these credentials which is similar to `getToken()`, but it does not read the `disableAutomaticAuthentication` option described above.
|
|
79
|
+
|
|
80
|
+
- Use this to get an `AuthenticationRecord` which you can then use to create new credentials that will re-use the token information.
|
|
81
|
+
- The `AuthenticationRecord` object has a `serialize()` method that allows an authenticated account to be stored as a string and re-used in another credential at any time. Use the new helper function `deserializeAuthenticationRecord` to de-serialize this string.
|
|
82
|
+
- `authenticate()` might succeed and still return `undefined` if we're unable to pick just one account record from the cache. This might happen if the cache is being used by more than one credential, or if multiple users have authenticated using the same Client ID and Tenant ID. To ensure consistency on a program with many users, please keep track of the `AuthenticationRecord` and provide them in the constructors of the credentials on initialization.
|
|
83
|
+
|
|
84
|
+
Learn more via the below samples
|
|
85
|
+
|
|
86
|
+
- [Samples around controlling user interaction](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#control-user-interaction).
|
|
87
|
+
- [Samples around persisting user authentication data](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#persist-user-authentication-data).
|
|
88
|
+
|
|
89
|
+
#### New features in ManagedIdentityCredential
|
|
90
|
+
|
|
91
|
+
In Identity v2, the `ManagedIdentityCredential` retries with exponential back-off when a request for a token fails with a 404 status code. This change only applies to environments with available IMDS endpoints.
|
|
92
|
+
|
|
93
|
+
Azure Service Fabric support hasn't been added on the initial version 2 of Identity. Subscribe to [issue #12420](https://github.com/Azure/azure-sdk-for-js/issues/12420) for updates on this feature.
|
|
94
|
+
|
|
95
|
+
#### Other features
|
|
96
|
+
|
|
97
|
+
- `ClientCertificateCredential` now optionally accepts a configuration object as its third constructor parameter, instead of the PEM certificate path. This new object, called `ClientCertificateCredentialPEMConfiguration`, can contain either the PEM certificate path with the `certificatePath` property, or the contents of the PEM certificate with the `certificate` property..
|
|
98
|
+
- The Node.js version of `InteractiveBrowserCredential` has [Proof Key for Code Exchange (PKCE)](https://datatracker.ietf.org/doc/html/rfc7636) enabled by default.
|
|
99
|
+
- `InteractiveBrowserCredential` has a new `loginHint` constructor option, which allows a username to be pre-selected for interactive logins.
|
|
100
|
+
- In `AzureCliCredential`, we allow specifying a `tenantId` in the parameters through the `AzureCliCredentialOptions`.
|
|
101
|
+
- A new error, named `AuthenticationRequiredError`, has been added. This error shows up when a credential fails to authenticate silently.
|
|
102
|
+
- Errors and logged exceptions may point to the new [troubleshooting guidelines](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/Troubleshooting.md).
|
|
103
|
+
- On all of the credentials we're providing, the initial authentication attempt in the lifetime of your app will include an additional request to first discover relevant endpoint metadata information from Azure.
|
|
104
|
+
|
|
105
|
+
### Breaking changes
|
|
106
|
+
|
|
107
|
+
#### Breaking changes from v1
|
|
108
|
+
|
|
109
|
+
- For `ClientCertificateCredential` specifically, the validity of the PEM certificate is evaluated on `getToken` and not on the constructor.
|
|
110
|
+
- We have also renamed the error `CredentialUnavailable` to `CredentialUnavailableError`, to align with the naming convention used for error classes in the Azure SDKs in JavaScript.
|
|
111
|
+
- In v1 of Identity some `getToken` calls could resolve with `null` in the case the authentication request succeeded with a malformed output. In v2, issues with the `getToken` method will always throw errors.
|
|
112
|
+
- Breaking changes to InteractiveBrowserCredential
|
|
113
|
+
- The `InteractiveBrowserCredential` will 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) to better support browsers with enhanced security restrictions. Learn how to migrate in the [migration guide](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/migration-v1-v2.md). Read more about the latest `InteractiveBrowserCredential` [here](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/interactive-browser-credential.md).
|
|
114
|
+
- The default client ID used for `InteractiveBrowserCredential` was viable only in Node.js and not for the browser. Therefore, on v2 client ID is a required parameter when using this credential in browser apps.
|
|
115
|
+
- Identity v2 also removes the `postLogoutRedirectUri` from the options to the constructor for `InteractiveBrowserCredential`. This option wasn't being used. Instead of using this option, use MSAL directly. For more information, see [Authenticating with the @azure/msal-browser Public Client](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-the-azuremsal-browser-public-client).
|
|
116
|
+
- In Identity v2, `VisualStudioCodeCredential` throws a `CredentialUnavailableError` unless the new [@azure/identity-vscode](https://www.npmjs.com/package/@azure/identity-vscode) plugin is used.
|
|
117
|
+
|
|
118
|
+
- Standardizing the tracing span names to be `<className>.<operationName>` over `<className>-<operationName>`
|
|
119
|
+
|
|
120
|
+
#### Breaking Changes from 2.0.0-beta.4
|
|
121
|
+
|
|
122
|
+
- Removed the `allowMultiTenantAuthentication` option from all of the credentials. Multi-tenant authentication is now enabled by default. On Node.js, it can be disabled with the `AZURE_IDENTITY_DISABLE_MULTITENANTAUTH` environment variable.
|
|
123
|
+
- Removed support for specific Azure regions on `ClientSecretCredential` and `ClientCertificateCredential. This feature will be added back on the next beta.
|
|
124
|
+
|
|
125
|
+
#### Breaking Changes from 2.0.0-beta.6
|
|
126
|
+
|
|
127
|
+
- Stopped exporting the `ApplicationCredential` from the package. This will be re-introduced in the future.
|
|
128
|
+
- Removed the `CredentialPersistenceOptions` from `DefaultAzureCredential` and `EnvironmentCredential`.
|
|
129
|
+
- Merged the configuration and the options bag on the `OnBehalfOfCredential` into a single options bag.
|
|
130
|
+
- `AuthenticationRequiredError` (introduced in 2.0.0-beta.1) now has its parameters into a single options bag.
|
|
131
|
+
- `AuthenticationRequiredError` (introduced in 2.0.0-beta.1) now has its parameters in a single options bag, `AuthenticationRequiredErrorOptions`.
|
|
132
|
+
- `InteractiveBrowserCredentialOptions` has been renamed to `InteractiveBrowserCredentialNodeOptions`, and `InteractiveBrowserCredentialBrowserOptions` has been named `InteractiveBrowserCredentialInBrowserOptions`.
|
|
133
|
+
|
|
134
|
+
### Bugs Fixed
|
|
135
|
+
|
|
136
|
+
- `ClientSecretCredential`, `ClientCertificateCredential`, and `UsernamePasswordCredential` throw if the required parameters aren't provided (even in JavaScript).
|
|
137
|
+
- Fixed a bug that caused `AzureCliCredential` to fail when a custom tenant ID was provided.
|
|
138
|
+
- Caught up with the bug fixes for Azure POD Identity that were implemented on version 1.5.1.
|
|
139
|
+
|
|
140
|
+
### Other Changes
|
|
141
|
+
|
|
142
|
+
Identity v2 no longer includes native dependencies (neither ordinary, peer, nor optional dependencies). Previous distributions of `@azure/identity` included an optional dependency on `keytar`, which caused issues for some users in restrictive environments.
|
|
143
|
+
|
|
144
|
+
Identity v2 for JavaScript now also depends on the latest available versions of `@azure/msal-common`, `@azure/msal-node`, and `@azure/msal-browser`. Our goal is to always be up-to-date with the MSAL versions.
|
|
145
|
+
|
|
146
|
+
## 2.0.0-beta.6 (2021-09-09)
|
|
147
|
+
|
|
148
|
+
### Features Added
|
|
149
|
+
|
|
150
|
+
- 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).
|
|
151
|
+
- `ManagedIdentityCredential` now supports token exchange authentication.
|
|
152
|
+
|
|
153
|
+
### Breaking Changes
|
|
154
|
+
|
|
155
|
+
- `ClientCertificateCredential` now evaluates the validity of the PEM certificate path on `getToken` and not on the constructor.
|
|
156
|
+
|
|
157
|
+
#### Breaking Changes from 2.0.0-beta.5
|
|
158
|
+
|
|
159
|
+
- The property named `selectedCredential` that was added to `ChainedTokenCredential` and `DefaultAzureCredential` has been removed, since customers reported that logging was enough.
|
|
160
|
+
- 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".
|
|
161
|
+
- 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.
|
|
162
|
+
|
|
163
|
+
### Bugs Fixed
|
|
164
|
+
|
|
165
|
+
- `ClientSecretCredential`, `ClientCertificateCredential` and `UsernamePasswordCredential` now throw if the required parameters are not provided (even in JavaScript).
|
|
166
|
+
- 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.
|
|
167
|
+
- Fixed bug on the `AggregateAuthenticationError`, which caused an inconsistent error message on the `ChainedTokenCredential`, `DefaultAzureCredential` and `ApplicationCredential`.
|
|
168
|
+
|
|
169
|
+
### Other Changes
|
|
170
|
+
|
|
171
|
+
- The errors thrown by the `ManagedIdentityCredential` have been improved.
|
|
172
|
+
|
|
173
|
+
## 1.5.2 (2021-09-01)
|
|
174
|
+
|
|
175
|
+
- 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.
|
|
176
|
+
|
|
177
|
+
## 1.5.1 (2021-08-12)
|
|
178
|
+
|
|
179
|
+
- 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.
|
|
180
|
+
- Added support for the `AZURE_POD_IDENTITY_AUTHORITY_HOST` environment variable. If present, the IMDS endpoint initial verification will be skipped.
|
|
181
|
+
|
|
182
|
+
## 2.0.0-beta.5 (2021-08-10)
|
|
183
|
+
|
|
184
|
+
### Features Added
|
|
185
|
+
|
|
186
|
+
- 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).
|
|
187
|
+
- `ChainedTokenCredential` and `DefaultAzureCredential` now expose a property named `selectedCredential`, which will store the selected credential once any of the available credentials succeeds.
|
|
188
|
+
- 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`.
|
|
189
|
+
|
|
190
|
+
### Breaking Changes
|
|
191
|
+
|
|
192
|
+
> These changes do not impact the API of stable versions such as 1.6.0.
|
|
193
|
+
> Only code written against a beta version such as 1.7.0b1 may be affected.
|
|
194
|
+
|
|
195
|
+
- Renamed `AZURE_POD_IDENTITY_TOKEN_URL` to `AZURE_POD_IDENTITY_AUTHORITY_HOST`.
|
|
196
|
+
|
|
197
|
+
### Bugs Fixed
|
|
198
|
+
|
|
199
|
+
- 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.
|
|
200
|
+
|
|
201
|
+
## 1.5.0 (2021-07-19)
|
|
202
|
+
|
|
203
|
+
- 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.
|
|
204
|
+
|
|
205
|
+
## 1.4.0 (2021-07-09)
|
|
206
|
+
|
|
207
|
+
- 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.
|
|
208
|
+
- 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.
|
|
209
|
+
- Upgraded `@azure/core-http` to version `^2.0.0`, and `@azure/core-tracing` to version `1.0.0-preview.12`.
|
|
210
|
+
|
|
211
|
+
- Upgraded the `AuthorizationCodeCredential` to use the latest `@azure/msal-node`.
|
|
212
|
+
|
|
3
213
|
## 2.0.0-beta.4 (2021-07-07)
|
|
4
214
|
|
|
5
215
|
### Features Added
|
|
216
|
+
|
|
6
217
|
- 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.
|
|
7
218
|
- 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:
|
|
8
219
|
- `@azure/identity-vscode`, which provides the dependencies of `VisualStudioCodeCredential` and enables it (see more below).
|
|
@@ -26,8 +237,8 @@
|
|
|
26
237
|
|
|
27
238
|
### Key Bugs Fixed
|
|
28
239
|
|
|
29
|
-
- Fixed an issue in which `InteractiveBrowserCredential` on Node would sometimes cause the process to
|
|
30
|
-
- Fixed an issue in which the `AZURE_AUTHORITY_HOST` environment variable was not properly picked up in
|
|
240
|
+
- Fixed an issue in which `InteractiveBrowserCredential` on Node would sometimes cause the process to not respond if there was no browser available.
|
|
241
|
+
- Fixed an issue in which the `AZURE_AUTHORITY_HOST` environment variable was not properly picked up in Node.js.
|
|
31
242
|
|
|
32
243
|
## 2.0.0-beta.3 (2021-05-12)
|
|
33
244
|
|
|
@@ -89,7 +300,7 @@ This update marks the preview for the first major version update of the `@azure/
|
|
|
89
300
|
- This feature uses DPAPI on Windows, it tries to use the Keychain on OSX and the Keyring on Linux.
|
|
90
301
|
- To learn more on the usage, please refer to our docs on the `TokenCachePersistenceOptions` interface.
|
|
91
302
|
- **IMPORTANT:** As part of this beta, this feature is only supported in Node 10, 12 and 14.
|
|
92
|
-
- Changes to `InteractiveBrowserCredential
|
|
303
|
+
- Changes to `InteractiveBrowserCredential` and `DeviceCodeCredential`:
|
|
93
304
|
- You can now control when the credential requests user input with the new `disableAutomaticAuthentication` option added to the options you pass to the credential constructors.
|
|
94
305
|
- When enabled, this option stops the `getToken()` method from requesting user input in case the credential is unable to authenticate silently.
|
|
95
306
|
- If `getToken()` fails to authenticate without user interaction, and `disableAutomaticAuthentication` has been set to true, a new error will be thrown: `AuthenticationRequired`. You may use this error to identify scenarios when manual authentication needs to be triggered (with `authenticate()`, as described in the next point).
|
|
@@ -118,7 +329,7 @@ This release doesn't have the changes from `1.2.4-beta.1`.
|
|
|
118
329
|
|
|
119
330
|
## 1.2.3 (2021-02-09)
|
|
120
331
|
|
|
121
|
-
- Fixed Azure Stack support for the
|
|
332
|
+
- 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).
|
|
122
333
|
- The 'keytar' dependency has been updated to the latest version.
|
|
123
334
|
- 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).
|
|
124
335
|
|
package/README.md
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
## Azure Identity client library for JavaScript
|
|
2
2
|
|
|
3
|
-
The Azure Identity library provides Azure Active Directory
|
|
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
|
|
|
5
|
-
|
|
5
|
+
For examples of various credentials, see the [Azure Identity examples page](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md).
|
|
6
6
|
|
|
7
7
|
Key links:
|
|
8
|
+
|
|
8
9
|
- [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity)
|
|
9
10
|
- [Package (npm)](https://www.npmjs.com/package/@azure/identity)
|
|
10
11
|
- [API Reference Documentation](https://docs.microsoft.com/javascript/api/@azure/identity)
|
|
@@ -13,6 +14,19 @@ Key links:
|
|
|
13
14
|
|
|
14
15
|
## Getting started
|
|
15
16
|
|
|
17
|
+
### Migrate from v1 to v2 of @azure/identity
|
|
18
|
+
|
|
19
|
+
If you're using v1 of `@azure/identity`, see the [migration guide](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/migration-v1-v2.md) to update to v2.
|
|
20
|
+
|
|
21
|
+
### Currently supported environments
|
|
22
|
+
|
|
23
|
+
- [LTS versions of Node.js](https://nodejs.org/about/releases/)
|
|
24
|
+
- **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.
|
|
25
|
+
- Latest versions of Safari, Chrome, Edge, and Firefox.
|
|
26
|
+
- **Note**: Among the different credentials exported in this library, `InteractiveBrowserCredential` is the only one that is supported in the browser.
|
|
27
|
+
|
|
28
|
+
See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details.
|
|
29
|
+
|
|
16
30
|
### Install the package
|
|
17
31
|
|
|
18
32
|
Install Azure Identity with `npm`:
|
|
@@ -26,12 +40,6 @@ npm install --save @azure/identity
|
|
|
26
40
|
- An [Azure subscription](https://azure.microsoft.com/free/).
|
|
27
41
|
- 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.
|
|
28
42
|
|
|
29
|
-
#### Supported Node.js versions
|
|
30
|
-
|
|
31
|
-
This version of `@azure/identity` supports stable (even numbered) versions of Node.js starting from v10. While it may run in Node.js v8, no support is guaranteed.
|
|
32
|
-
|
|
33
|
-
> **Note:** If your application runs on Node.js v8 or lower, we strongly recommend you to upgrade your Node.js version to latest stable version or pin your `@azure/identity` dependency to version 1.1.0.
|
|
34
|
-
|
|
35
43
|
### When to use @azure/identity
|
|
36
44
|
|
|
37
45
|
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.
|
|
@@ -78,6 +86,14 @@ To authenticate with [Azure PowerShell][azure_powershell] users can run the `Con
|
|
|
78
86
|
|
|
79
87
|
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.
|
|
80
88
|
|
|
89
|
+
#### Authenticate via Visual Studio Code
|
|
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.
|
|
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.
|
|
94
|
+
|
|
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
|
+
|
|
81
97
|
### Authenticate the client in browsers
|
|
82
98
|
|
|
83
99
|
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.
|
|
@@ -100,21 +116,22 @@ The `DefaultAzureCredential` is appropriate for most scenarios where the applica
|
|
|
100
116
|
|
|
101
117
|
> 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.
|
|
102
118
|
|
|
103
|
-
If used from
|
|
119
|
+
If used from Node.js, the `DefaultAzureCredential` will attempt to authenticate via the following mechanisms in order:
|
|
104
120
|
|
|
105
121
|
![DefaultAzureCredential authentication flow][defaultauthflow_image]
|
|
106
122
|
|
|
107
123
|
- Environment - The `DefaultAzureCredential` will read account information specified via [environment variables](#environment-variables) and use it to authenticate.
|
|
108
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.
|
|
109
126
|
- Azure CLI - If the developer has authenticated an account via the Azure CLI `az login` command, the `DefaultAzureCredential` will authenticate with that account.
|
|
110
127
|
- Azure PowerShell - If the developer has authenticated using the Azure PowerShell module `Connect-AzAccount` command, the `DefaultAzureCredential` will authenticate with that account.
|
|
111
128
|
|
|
112
|
-
##
|
|
129
|
+
## Plugins
|
|
113
130
|
|
|
114
|
-
Azure Identity for JavaScript provides
|
|
131
|
+
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:
|
|
115
132
|
|
|
116
|
-
- [`@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
|
|
117
|
-
- [`@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
|
|
133
|
+
- [`@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.
|
|
134
|
+
- [`@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.
|
|
118
135
|
|
|
119
136
|
## Environment Variables
|
|
120
137
|
|
|
@@ -206,12 +223,30 @@ The [Managed identity authentication](https://docs.microsoft.com/azure/active-di
|
|
|
206
223
|
|
|
207
224
|
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)
|
|
208
225
|
|
|
226
|
+
## Cloud configuration
|
|
227
|
+
|
|
228
|
+
Credentials default to authenticating to the Azure AD endpoint for Azure Public Cloud. To access resources in other clouds, such as Azure Government or a private cloud, configure credentials with the `authorityHost` argument in the constructor. The `AzureAuthorityHosts` interface defines authorities for well-known clouds. For the US Government cloud, you could instantiate a credential this way:
|
|
229
|
+
|
|
230
|
+
```ts
|
|
231
|
+
import { AzureAuthorityHosts, ClientSecretCredential } from "@azure/identity";
|
|
232
|
+
const credential = new ClientSecretCredential(
|
|
233
|
+
"<YOUR_TENANT_ID>",
|
|
234
|
+
"<YOUR_CLIENT_ID>",
|
|
235
|
+
"<YOUR_CLIENT_SECRET>",
|
|
236
|
+
{
|
|
237
|
+
authorityHost: AzureAuthorityHosts.AzureGovernment
|
|
238
|
+
}
|
|
239
|
+
);
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
Not all credentials require this configuration. Credentials that authenticate through a development tool, such as `AzureCliCredential`, use that tool's configuration. Similarly, `VisualStudioCodeCredential` accepts an `authorityHost` argument but defaults to the `authorityHost` matching Visual Studio Code's **Azure: Cloud** setting.
|
|
243
|
+
|
|
209
244
|
## Credential Classes
|
|
210
245
|
|
|
211
246
|
### Authenticating Azure Hosted Applications
|
|
212
247
|
|
|
213
|
-
| credential | usage | example
|
|
214
|
-
| --------------------------- | ---------------------------------------------------------------------------------------------------------------- |
|
|
248
|
+
| credential | usage | example |
|
|
249
|
+
| --------------------------- | ---------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
215
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) |
|
|
216
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) |
|
|
217
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) |
|
|
@@ -219,24 +254,24 @@ For examples of how to use managed identity for authentication please refer to [
|
|
|
219
254
|
|
|
220
255
|
### Authenticating Service Principals
|
|
221
256
|
|
|
222
|
-
| credential | usage | example
|
|
223
|
-
| ----------------------------- | ------------------------------------------------------ |
|
|
257
|
+
| credential | usage | example | reference |
|
|
258
|
+
| ----------------------------- | ------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
|
|
224
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) |
|
|
225
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) |
|
|
226
261
|
|
|
227
262
|
### Authenticating Users
|
|
228
263
|
|
|
229
|
-
| credential | usage
|
|
230
|
-
| ------------------------------ |
|
|
264
|
+
| credential | usage | example | reference |
|
|
265
|
+
| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
|
|
231
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) |
|
|
232
|
-
| `DeviceCodeCredential` | Interactively authenticates a user on devices with limited UI.
|
|
233
|
-
| `UsernamePasswordCredential` | Authenticates a user with a username and password.
|
|
234
|
-
| `AuthorizationCodeCredential` | Authenticate a user with a previously obtained authorization code.
|
|
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) |
|
|
235
270
|
|
|
236
271
|
### Authenticating via Development Tools
|
|
237
272
|
|
|
238
|
-
| credential | usage | example
|
|
239
|
-
| --------------------------- | ----------------------------------------------------------------- |
|
|
273
|
+
| credential | usage | example | reference |
|
|
274
|
+
| --------------------------- | ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
|
|
240
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) |
|
|
241
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) |
|
|
242
277
|
|
|
@@ -248,7 +283,13 @@ Credentials raise `AuthenticationError` when they fail to authenticate. This cla
|
|
|
248
283
|
|
|
249
284
|
### Logging
|
|
250
285
|
|
|
251
|
-
Enabling logging may help uncover useful information about failures.
|
|
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:
|
|
287
|
+
|
|
288
|
+
```javascript
|
|
289
|
+
require("dotenv").config({ path: ".env" });
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
Alternatively, logging can be enabled at runtime by calling `setLogLevel` from the `@azure/logger` package:
|
|
252
293
|
|
|
253
294
|
```javascript
|
|
254
295
|
import { setLogLevel } from "@azure/logger";
|
|
@@ -256,12 +297,24 @@ import { setLogLevel } from "@azure/logger";
|
|
|
256
297
|
setLogLevel("info");
|
|
257
298
|
```
|
|
258
299
|
|
|
300
|
+
For assistance with troubleshooting, see the [troubleshooting guide](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/Troubleshooting.md).
|
|
301
|
+
|
|
259
302
|
## Next steps
|
|
260
303
|
|
|
261
304
|
### Read the documentation
|
|
262
305
|
|
|
263
306
|
API documentation for this library can be found on our [documentation site](https://docs.microsoft.com/javascript/api/@azure/identity).
|
|
264
307
|
|
|
308
|
+
### Client library support
|
|
309
|
+
|
|
310
|
+
Client and management libraries listed on the [Azure SDK releases page](https://azure.github.io/azure-sdk/releases/latest/js.html) that support Azure AD authentication accept credentials from this library. Learn more about using these libraries in their documentation, which is linked from the releases page.
|
|
311
|
+
|
|
312
|
+
### Known Issues
|
|
313
|
+
|
|
314
|
+
#### Azure AD B2C support
|
|
315
|
+
|
|
316
|
+
This library does not support the [Azure AD B2C](https://docs.microsoft.com/azure/active-directory-b2c/overview) service.
|
|
317
|
+
|
|
265
318
|
### Provide Feedback
|
|
266
319
|
|
|
267
320
|
If you encounter bugs or have suggestions, please [open an issue](https://github.com/Azure/azure-sdk-for-js/issues).
|