@azure/identity 4.0.0-alpha.20230210.3 → 4.0.0-alpha.20231026.4
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/README.md +39 -65
- package/dist/index.js +846 -577
- package/dist/index.js.map +1 -1
- package/dist-esm/src/client/identityClient.js +11 -2
- package/dist-esm/src/client/identityClient.js.map +1 -1
- package/dist-esm/src/constants.js +2 -0
- package/dist-esm/src/constants.js.map +1 -1
- package/dist-esm/src/credentials/authorityValidationOptions.js.map +1 -1
- package/dist-esm/src/credentials/authorizationCodeCredential.js +6 -6
- package/dist-esm/src/credentials/authorizationCodeCredential.js.map +1 -1
- package/dist-esm/src/credentials/azureCliCredential.js +17 -10
- package/dist-esm/src/credentials/azureCliCredential.js.map +1 -1
- package/dist-esm/src/credentials/azureCliCredentialOptions.js.map +1 -1
- package/dist-esm/src/credentials/azureDeveloperCliCredential.js +52 -18
- package/dist-esm/src/credentials/azureDeveloperCliCredential.js.map +1 -1
- package/dist-esm/src/credentials/azureDeveloperCliCredentialOptions.js.map +1 -1
- package/dist-esm/src/credentials/azurePowerShellCredential.js +27 -13
- package/dist-esm/src/credentials/azurePowerShellCredential.js.map +1 -1
- package/dist-esm/src/credentials/azurePowerShellCredentialOptions.js.map +1 -1
- package/dist-esm/src/credentials/brokerAuthOptions.js +2 -0
- package/dist-esm/src/credentials/brokerAuthOptions.js.map +1 -0
- package/dist-esm/src/credentials/browserCustomizationOptions.js +4 -0
- package/dist-esm/src/credentials/browserCustomizationOptions.js.map +1 -0
- package/dist-esm/src/credentials/chainedTokenCredential.js +8 -4
- package/dist-esm/src/credentials/chainedTokenCredential.js.map +1 -1
- package/dist-esm/src/credentials/clientAssertionCredential.js +6 -6
- package/dist-esm/src/credentials/clientAssertionCredential.js.map +1 -1
- package/dist-esm/src/credentials/clientCertificateCredential.browser.js +1 -1
- package/dist-esm/src/credentials/clientCertificateCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/clientCertificateCredential.js +6 -6
- package/dist-esm/src/credentials/clientCertificateCredential.js.map +1 -1
- package/dist-esm/src/credentials/clientSecretCredential.browser.js +7 -7
- package/dist-esm/src/credentials/clientSecretCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/clientSecretCredential.js +8 -8
- package/dist-esm/src/credentials/clientSecretCredential.js.map +1 -1
- package/dist-esm/src/credentials/defaultAzureCredential.js +56 -4
- package/dist-esm/src/credentials/defaultAzureCredential.js.map +1 -1
- package/dist-esm/src/credentials/defaultAzureCredentialOptions.js.map +1 -1
- package/dist-esm/src/credentials/deviceCodeCredential.browser.js +1 -1
- package/dist-esm/src/credentials/deviceCodeCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/deviceCodeCredential.js +7 -7
- 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 +1 -1
- package/dist-esm/src/credentials/environmentCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/environmentCredential.js +3 -3
- package/dist-esm/src/credentials/environmentCredential.js.map +1 -1
- package/dist-esm/src/credentials/environmentCredentialOptions.js.map +1 -1
- package/dist-esm/src/credentials/interactiveBrowserCredential.browser.js +9 -9
- package/dist-esm/src/credentials/interactiveBrowserCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/interactiveBrowserCredential.js +29 -12
- 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 +1 -0
- package/dist-esm/src/credentials/managedIdentityCredential/appServiceMsi2017.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/appServiceMsi2019.js +1 -0
- package/dist-esm/src/credentials/managedIdentityCredential/appServiceMsi2019.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/arcMsi.js +1 -0
- package/dist-esm/src/credentials/managedIdentityCredential/arcMsi.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/cloudShellMsi.js +1 -0
- package/dist-esm/src/credentials/managedIdentityCredential/cloudShellMsi.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/fabricMsi.js +1 -0
- package/dist-esm/src/credentials/managedIdentityCredential/fabricMsi.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/imdsMsi.js +15 -4
- package/dist-esm/src/credentials/managedIdentityCredential/imdsMsi.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/index.js +65 -31
- 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 +10 -65
- package/dist-esm/src/credentials/managedIdentityCredential/tokenExchangeMsi.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/utils.js +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/utils.js.map +1 -1
- package/dist-esm/src/credentials/onBehalfOfCredential.browser.js +1 -1
- package/dist-esm/src/credentials/onBehalfOfCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/onBehalfOfCredential.js +5 -5
- package/dist-esm/src/credentials/onBehalfOfCredential.js.map +1 -1
- package/dist-esm/src/credentials/onBehalfOfCredentialOptions.js.map +1 -1
- package/dist-esm/src/credentials/usernamePasswordCredential.browser.js +6 -6
- package/dist-esm/src/credentials/usernamePasswordCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/usernamePasswordCredential.js +7 -7
- package/dist-esm/src/credentials/usernamePasswordCredential.js.map +1 -1
- package/dist-esm/src/credentials/usernamePasswordCredentialOptions.js.map +1 -1
- package/dist-esm/src/credentials/visualStudioCodeCredential.js +3 -4
- package/dist-esm/src/credentials/visualStudioCodeCredential.js.map +1 -1
- package/dist-esm/src/credentials/workloadIdentityCredential.browser.js +27 -0
- package/dist-esm/src/credentials/workloadIdentityCredential.browser.js.map +1 -0
- package/dist-esm/src/credentials/workloadIdentityCredential.js +104 -0
- package/dist-esm/src/credentials/workloadIdentityCredential.js.map +1 -0
- package/dist-esm/src/credentials/workloadIdentityCredentialOptions.js +4 -0
- package/dist-esm/src/credentials/workloadIdentityCredentialOptions.js.map +1 -0
- package/dist-esm/src/errors.js.map +1 -1
- package/dist-esm/src/index.js +2 -0
- package/dist-esm/src/index.js.map +1 -1
- package/dist-esm/src/msal/browserFlows/msalAuthCode.js +3 -1
- package/dist-esm/src/msal/browserFlows/msalAuthCode.js.map +1 -1
- package/dist-esm/src/msal/browserFlows/msalBrowserCommon.js +2 -2
- package/dist-esm/src/msal/browserFlows/msalBrowserCommon.js.map +1 -1
- package/dist-esm/src/msal/credentials.js.map +1 -1
- package/dist-esm/src/msal/flows.js.map +1 -1
- package/dist-esm/src/msal/nodeFlows/brokerOptions.js +2 -0
- package/dist-esm/src/msal/nodeFlows/brokerOptions.js.map +1 -0
- package/dist-esm/src/msal/nodeFlows/msalAuthorizationCode.js +6 -4
- package/dist-esm/src/msal/nodeFlows/msalAuthorizationCode.js.map +1 -1
- package/dist-esm/src/msal/nodeFlows/msalClientAssertion.js +1 -1
- package/dist-esm/src/msal/nodeFlows/msalClientAssertion.js.map +1 -1
- package/dist-esm/src/msal/nodeFlows/msalClientCertificate.js +1 -1
- package/dist-esm/src/msal/nodeFlows/msalClientCertificate.js.map +1 -1
- package/dist-esm/src/msal/nodeFlows/msalClientSecret.js +1 -1
- package/dist-esm/src/msal/nodeFlows/msalClientSecret.js.map +1 -1
- package/dist-esm/src/msal/nodeFlows/msalDeviceCode.js +1 -1
- package/dist-esm/src/msal/nodeFlows/msalDeviceCode.js.map +1 -1
- package/dist-esm/src/msal/nodeFlows/msalNodeCommon.js +117 -21
- package/dist-esm/src/msal/nodeFlows/msalNodeCommon.js.map +1 -1
- package/dist-esm/src/msal/nodeFlows/msalOnBehalfOf.js +1 -1
- package/dist-esm/src/msal/nodeFlows/msalOnBehalfOf.js.map +1 -1
- package/dist-esm/src/msal/nodeFlows/msalOpenBrowser.js +40 -139
- package/dist-esm/src/msal/nodeFlows/msalOpenBrowser.js.map +1 -1
- package/dist-esm/src/msal/nodeFlows/msalUsernamePassword.js +1 -1
- package/dist-esm/src/msal/nodeFlows/msalUsernamePassword.js.map +1 -1
- package/dist-esm/src/msal/types.js.map +1 -1
- package/dist-esm/src/msal/utils.browser.js +236 -0
- package/dist-esm/src/msal/utils.browser.js.map +1 -0
- package/dist-esm/src/msal/utils.js +8 -5
- package/dist-esm/src/msal/utils.js.map +1 -1
- package/dist-esm/src/plugins/consumer.js +2 -1
- package/dist-esm/src/plugins/consumer.js.map +1 -1
- package/dist-esm/src/plugins/provider.js.map +1 -1
- package/dist-esm/src/tokenCredentialOptions.js.map +1 -1
- package/dist-esm/src/util/processMultiTenantRequest.js +5 -2
- package/dist-esm/src/util/processMultiTenantRequest.js.map +1 -1
- package/dist-esm/src/util/scopeUtils.js +2 -2
- package/dist-esm/src/util/scopeUtils.js.map +1 -1
- package/dist-esm/src/util/tenantIdUtils.js +3 -3
- package/dist-esm/src/util/tenantIdUtils.js.map +1 -1
- package/package.json +21 -19
- package/types/identity.d.ts +297 -67
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Azure Identity client library for JavaScript
|
|
2
2
|
|
|
3
|
-
The Azure Identity library provides [
|
|
3
|
+
The Azure Identity library provides [Microsoft Entra ID](https://learn.microsoft.com/azure/active-directory/fundamentals/active-directory-whatis) ([formerly Azure Active Directory](https://learn.microsoft.com/azure/active-directory/fundamentals/new-name)) token authentication through a set of convenient [TokenCredential](https://learn.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
|
|
|
@@ -9,7 +9,7 @@ Key links:
|
|
|
9
9
|
- [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity)
|
|
10
10
|
- [Package (npm)](https://www.npmjs.com/package/@azure/identity)
|
|
11
11
|
- [API Reference Documentation](https://learn.microsoft.com/javascript/api/@azure/identity)
|
|
12
|
-
- [
|
|
12
|
+
- [Microsoft Entra ID documentation](https://azure.microsoft.com/services/active-directory/)
|
|
13
13
|
- [Samples](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/v2)
|
|
14
14
|
|
|
15
15
|
## Getting started
|
|
@@ -68,9 +68,9 @@ While we recommend using managed identity or service principal authentication in
|
|
|
68
68
|
|
|
69
69
|
Developers coding outside of an IDE can also use the [Azure Developer CLI][azure_developer_cli] to authenticate. Applications using the `DefaultAzureCredential` or the `AzureDeveloperCliCredential` can then use this account to authenticate calls in their application when running locally.
|
|
70
70
|
|
|
71
|
-
To authenticate with the [Azure Developer CLI][azure_developer_cli], users can run the command `azd login`. For users running on a system with a default web browser, the Azure Developer CLI will launch the browser to authenticate the user.
|
|
71
|
+
To authenticate with the [Azure Developer CLI][azure_developer_cli], users can run the command `azd auth login`. For users running on a system with a default web browser, the Azure Developer CLI will launch the browser to authenticate the user.
|
|
72
72
|
|
|
73
|
-
For systems without a default web browser, the `azd login --use-device-code` command will use the device code authentication flow.
|
|
73
|
+
For systems without a default web browser, the `azd auth login --use-device-code` command will use the device code authentication flow.
|
|
74
74
|
|
|
75
75
|
#### Authenticate via the Azure CLI
|
|
76
76
|
|
|
@@ -110,13 +110,13 @@ To authenticate Azure SDK clients within web browsers, we offer the `Interactive
|
|
|
110
110
|
|
|
111
111
|
## Key concepts
|
|
112
112
|
|
|
113
|
-
If this is your first time using `@azure/identity` or
|
|
113
|
+
If this is your first time using `@azure/identity` or Microsoft Entra ID, read [Using `@azure/identity` with Microsoft Entra ID](https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/using-azure-identity.md) first. This document provides a deeper understanding of the platform and how to configure your Azure account correctly.
|
|
114
114
|
|
|
115
115
|
### Credentials
|
|
116
116
|
|
|
117
117
|
A credential is a class which contains or can obtain the data needed for a service client to authenticate requests. Service clients across the Azure SDK accept credentials when they're constructed. Service clients use those credentials to authenticate requests to the service.
|
|
118
118
|
|
|
119
|
-
The Azure Identity library focuses on OAuth authentication with
|
|
119
|
+
The Azure Identity library focuses on OAuth authentication with Microsoft Entra ID, and it offers a variety of credential classes capable of acquiring a Microsoft Entra 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.
|
|
120
120
|
|
|
121
121
|
See [Credential Classes](#credential-classes).
|
|
122
122
|
|
|
@@ -131,11 +131,18 @@ If used from Node.js, the `DefaultAzureCredential` will attempt to authenticate
|
|
|
131
131
|
![DefaultAzureCredential authentication flow][defaultauthflow_image]
|
|
132
132
|
|
|
133
133
|
1. **Environment** - The `DefaultAzureCredential` will read account information specified via [environment variables](#environment-variables) and use it to authenticate.
|
|
134
|
+
1. **Workload Identity** - If the application is deployed to Azure Kubernetes Service with Managed Identity enabled, `DefaultAzureCredential` will authenticate with it.
|
|
134
135
|
1. **Managed Identity** - If the application is deployed to an Azure host with Managed Identity enabled, the `DefaultAzureCredential` will authenticate with that account.
|
|
135
|
-
1. **Azure Developer CLI** - If the developer has authenticated an account via the Azure Developer CLI `azd login` command, the `DefaultAzureCredential` will authenticate with that account.
|
|
136
|
+
1. **Azure Developer CLI** - If the developer has authenticated an account via the Azure Developer CLI `azd auth login` command, the `DefaultAzureCredential` will authenticate with that account.
|
|
136
137
|
1. **Azure CLI** - If the developer has authenticated an account via the Azure CLI `az login` command, the `DefaultAzureCredential` will authenticate with that account.
|
|
137
138
|
1. **Azure PowerShell** - If the developer has authenticated using the Azure PowerShell module `Connect-AzAccount` command, the `DefaultAzureCredential` will authenticate with that account.
|
|
138
139
|
|
|
140
|
+
#### Continuation policy
|
|
141
|
+
|
|
142
|
+
As of version 3.3.0, `DefaultAzureCredential` will attempt to authenticate with all developer credentials until one succeeds, regardless of any errors previous developer credentials experienced. For example, a developer credential may attempt to get a token and fail, so `DefaultAzureCredential` will continue to the next credential in the flow. Deployed service credentials will stop the flow with a thrown exception if they're able to attempt token retrieval, but don't receive one.
|
|
143
|
+
|
|
144
|
+
This allows for trying all of the developer credentials on your machine while having predictable deployed behavior.
|
|
145
|
+
|
|
139
146
|
#### Note about `VisualStudioCodeCredential`
|
|
140
147
|
|
|
141
148
|
Due to a [known issue](https://github.com/Azure/azure-sdk-for-js/issues/20500), `VisualStudioCodeCredential` has been removed from the `DefaultAzureCredential` token chain. When the issue is resolved in a future release, this change will be reverted.
|
|
@@ -160,10 +167,10 @@ This example demonstrates authenticating the `KeyClient` from the [@azure/keyvau
|
|
|
160
167
|
// If environment configuration is incomplete, it will try managed identity.
|
|
161
168
|
|
|
162
169
|
// Azure Key Vault service to use
|
|
163
|
-
|
|
170
|
+
import { KeyClient } from "@azure/keyvault-keys";
|
|
164
171
|
|
|
165
172
|
// Azure authentication library to access Azure Key Vault
|
|
166
|
-
|
|
173
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
167
174
|
|
|
168
175
|
// Azure SDK clients accept the credential as a parameter
|
|
169
176
|
const credential = new DefaultAzureCredential();
|
|
@@ -180,8 +187,8 @@ A relatively common scenario involves authenticating using a user-assigned manag
|
|
|
180
187
|
|
|
181
188
|
While the `DefaultAzureCredential` is generally the quickest way to get started developing applications for Azure, more advanced users may want to customize the credentials considered when authenticating. The `ChainedTokenCredential` enables users to combine multiple credential instances to define a customized chain of credentials. This example demonstrates creating a `ChainedTokenCredential` which will attempt to authenticate using two differently configured instances of `ClientSecretCredential`, to then authenticate the `KeyClient` from the [@azure/keyvault-keys](https://www.npmjs.com/package/@azure/keyvault-keys):
|
|
182
189
|
|
|
183
|
-
```
|
|
184
|
-
|
|
190
|
+
```typescript
|
|
191
|
+
import { ClientSecretCredential, ChainedTokenCredential } from "@azure/identity";
|
|
185
192
|
|
|
186
193
|
// When an access token is requested, the chain will try each
|
|
187
194
|
// credential in order, stopping when one provides a token
|
|
@@ -190,7 +197,7 @@ const secondCredential = new ClientSecretCredential(tenantId, anotherClientId, a
|
|
|
190
197
|
const credentialChain = new ChainedTokenCredential(firstCredential, secondCredential);
|
|
191
198
|
|
|
192
199
|
// The chain can be used anywhere a credential is required
|
|
193
|
-
|
|
200
|
+
import { KeyClient } from "@azure/keyvault-keys";
|
|
194
201
|
const client = new KeyClient(vaultUrl, credentialChain);
|
|
195
202
|
```
|
|
196
203
|
|
|
@@ -210,9 +217,9 @@ For examples of how to use managed identity for authentication, see [the example
|
|
|
210
217
|
|
|
211
218
|
## Cloud configuration
|
|
212
219
|
|
|
213
|
-
Credentials default to authenticating to the
|
|
220
|
+
Credentials default to authenticating to the Microsoft Entra 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:
|
|
214
221
|
|
|
215
|
-
```
|
|
222
|
+
```typescript
|
|
216
223
|
import { AzureAuthorityHosts, ClientSecretCredential } from "@azure/identity";
|
|
217
224
|
const credential = new ClientSecretCredential(
|
|
218
225
|
"<YOUR_TENANT_ID>",
|
|
@@ -236,6 +243,7 @@ Not all credentials require this configuration. Credentials that authenticate th
|
|
|
236
243
|
| [`ChainedTokenCredential`](https://learn.microsoft.com/javascript/api/@azure/identity/chainedtokencredential?view=azure-node-latest) | Allows users to define custom authentication flows composing multiple credentials. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#chaining-credentials) |
|
|
237
244
|
| [`EnvironmentCredential`](https://learn.microsoft.com/javascript/api/@azure/identity/environmentcredential?view=azure-node-latest) | Authenticates a service principal or user via credential information specified in environment variables. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-service-principal-with-environment-credentials) |
|
|
238
245
|
| [`ManagedIdentityCredential`](https://learn.microsoft.com/javascript/api/@azure/identity/managedidentitycredential?view=azure-node-latest) | Authenticates the managed identity of an Azure resource. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-in-azure-with-managed-identity) |
|
|
246
|
+
| [`WorkloadIdentityCredential`](https://learn.microsoft.com/javascript/api/@azure/identity/workloadidentitycredential?view=azure-node-latest)| Supports [Microsoft Entra Workload ID](https://learn.microsoft.com/azure/aks/workload-identity-overview) on Kubernetes. | |
|
|
239
247
|
|
|
240
248
|
### Authenticate service principals
|
|
241
249
|
|
|
@@ -259,8 +267,8 @@ Not all credentials require this configuration. Credentials that authenticate th
|
|
|
259
267
|
|
|
260
268
|
| Credential | Usage | Example | Reference |
|
|
261
269
|
| ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
|
|
262
|
-
| `AzureDeveloperCliCredential` | Authenticate in a development environment with the enabled user or service principal in Azure Developer CLI. | | [Azure Developer CLI Reference](https://learn.microsoft.com/azure/developer/azure-developer-cli/reference) |
|
|
263
270
|
| [`AzureCliCredential`](https://learn.microsoft.com/javascript/api/@azure/identity/azureclicredential?view=azure-node-latest) | Authenticate in a development environment with the Azure CLI. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-user-account-with-azure-cli) | [Azure CLI authentication](https://learn.microsoft.com/cli/azure/authenticate-azure-cli) |
|
|
271
|
+
| [`AzureDeveloperCliCredential`](https://learn.microsoft.com/javascript/api/@azure/identity/azuredeveloperclicredential?view=azure-node-latest) | Authenticate in a development environment with the enabled user or service principal in Azure Developer CLI. | | [Azure Developer CLI Reference](https://learn.microsoft.com/azure/developer/azure-developer-cli/reference) |
|
|
264
272
|
| [`AzurePowerShellCredential`](https://learn.microsoft.com/javascript/api/@azure/identity/azurepowershellcredential?view=azure-node-latest) | Authenticate in a development environment using Azure PowerShell. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-user-account-with-azure-powershell) | [Azure PowerShell authentication](https://learn.microsoft.com/powershell/azure/authenticate-azureps) |
|
|
265
273
|
| [`VisualStudioCodeCredential`](https://learn.microsoft.com/javascript/api/@azure/identity/visualstudiocodecredential?view=azure-node-latest) | Authenticates as the user signed in to the Visual Studio Code Azure Account extension.| | [VS Code Azure Account extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.azure-account)
|
|
266
274
|
|
|
@@ -272,16 +280,16 @@ Not all credentials require this configuration. Credentials that authenticate th
|
|
|
272
280
|
|
|
273
281
|
| Variable name | Value |
|
|
274
282
|
| --------------------- | --------------------------------------- |
|
|
275
|
-
| `AZURE_CLIENT_ID` | ID of
|
|
276
|
-
| `AZURE_TENANT_ID` | ID of the application's
|
|
283
|
+
| `AZURE_CLIENT_ID` | ID of a Microsoft Entra application |
|
|
284
|
+
| `AZURE_TENANT_ID` | ID of the application's Microsoft Entra tenant |
|
|
277
285
|
| `AZURE_CLIENT_SECRET` | one of the application's client secrets |
|
|
278
286
|
|
|
279
287
|
#### Service principal with certificate
|
|
280
288
|
|
|
281
289
|
| Variable name | Value |
|
|
282
290
|
| ----------------------------------- | ------------------------------------------------------------ |
|
|
283
|
-
| `AZURE_CLIENT_ID` | ID of
|
|
284
|
-
| `AZURE_TENANT_ID` | ID of the application's
|
|
291
|
+
| `AZURE_CLIENT_ID` | ID of a Microsoft Entra application |
|
|
292
|
+
| `AZURE_TENANT_ID` | ID of the application's Microsoft Entra tenant |
|
|
285
293
|
| `AZURE_CLIENT_CERTIFICATE_PATH` | path to a PEM-encoded certificate file including private key |
|
|
286
294
|
| `AZURE_CLIENT_CERTIFICATE_PASSWORD` | password of the certificate file, if any |
|
|
287
295
|
|
|
@@ -289,62 +297,28 @@ Not all credentials require this configuration. Credentials that authenticate th
|
|
|
289
297
|
|
|
290
298
|
| Variable name | Value |
|
|
291
299
|
| ----------------- | --------------------------------------- |
|
|
292
|
-
| `AZURE_CLIENT_ID` | ID of
|
|
293
|
-
| `AZURE_TENANT_ID` | ID of the application's
|
|
300
|
+
| `AZURE_CLIENT_ID` | ID of a Microsoft Entra application |
|
|
301
|
+
| `AZURE_TENANT_ID` | ID of the application's Microsoft Entra tenant |
|
|
294
302
|
| `AZURE_USERNAME` | a username (usually an email address) |
|
|
295
303
|
| `AZURE_PASSWORD` | that user's password |
|
|
296
304
|
|
|
297
305
|
Configuration is attempted in the above order. For example, if values for a client secret and certificate are both present, the client secret will be used.
|
|
298
306
|
|
|
299
|
-
##
|
|
300
|
-
|
|
301
|
-
### Error handling
|
|
307
|
+
## Continuous Access Evaluation
|
|
302
308
|
|
|
303
|
-
|
|
309
|
+
As of version 3.3.0, accessing resources protected by [Continuous Access Evaluation](https://learn.microsoft.com/azure/active-directory/conditional-access/concept-continuous-access-evaluation) (CAE) is possible on a per-request basis. This can be enabled using the [`GetTokenOptions.enableCae(boolean)` API](https://learn.microsoft.com/javascript/api/@azure/core-auth/gettokenoptions?view=azure-node-latest#@azure-core-auth-gettokenoptions-enablecae). CAE isn't supported for developer credentials.
|
|
304
310
|
|
|
305
|
-
|
|
311
|
+
## Token caching
|
|
306
312
|
|
|
307
|
-
|
|
313
|
+
Token caching is a feature provided by the Azure Identity library that allows apps to:
|
|
308
314
|
|
|
309
|
-
|
|
310
|
-
|
|
315
|
+
- Cache tokens in memory (default) and on disk (opt-in).
|
|
316
|
+
- Improve resilience and performance.
|
|
317
|
+
- Reduce the number of requests made to Microsoft Entra ID to obtain access tokens.
|
|
311
318
|
|
|
312
|
-
|
|
313
|
-
require("dotenv").config({ path: ".env" });
|
|
314
|
-
```
|
|
315
|
-
|
|
316
|
-
Alternatively, logging can be enabled at runtime by calling `setLogLevel` from the `@azure/logger` package:
|
|
319
|
+
The Azure Identity library offers both in-memory and persistent disk caching. For more details, see the [token caching documentation](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/TOKEN_CACHING.md).
|
|
317
320
|
|
|
318
|
-
|
|
319
|
-
import { setLogLevel } from "@azure/logger";
|
|
320
|
-
|
|
321
|
-
setLogLevel("info");
|
|
322
|
-
```
|
|
323
|
-
|
|
324
|
-
In cases where the authenticate code might be running in an environment with more than one credential available,
|
|
325
|
-
the `@azure/identity` package offers a unique form of logging. On the optional parameters for every credential,
|
|
326
|
-
developers can set `allowLoggingAccountIdentifiers` to true in the
|
|
327
|
-
`loggingOptions` to log information specific to the authenticated account after
|
|
328
|
-
each successful authentication, including the Client ID, the Tenant ID, the
|
|
329
|
-
Object ID of the authenticated user, and if possible the User Principal Name.
|
|
330
|
-
|
|
331
|
-
For example, using the `DefaultAzureCredential`:
|
|
332
|
-
|
|
333
|
-
```js
|
|
334
|
-
import { setLogLevel } from "@azure/logger";
|
|
335
|
-
|
|
336
|
-
setLogLevel("info");
|
|
337
|
-
|
|
338
|
-
const credential = new DefaultAzureCredential({
|
|
339
|
-
loggingOptions: { allowLoggingAccountIdentifiers: true },
|
|
340
|
-
});
|
|
341
|
-
```
|
|
342
|
-
|
|
343
|
-
Once that credential authenticates, the following message will appear in the logs (with the real information instead of `HIDDEN`):
|
|
344
|
-
|
|
345
|
-
```
|
|
346
|
-
azure:identity:info [Authenticated account] Client ID: HIDDEN. Tenant ID: HIDDEN. User Principal Name: HIDDEN. Object ID (user): HIDDEN
|
|
347
|
-
```
|
|
321
|
+
## Troubleshooting
|
|
348
322
|
|
|
349
323
|
For assistance with troubleshooting, see the [troubleshooting guide](https://aka.ms/azsdk/js/identity/troubleshoot).
|
|
350
324
|
|
|
@@ -356,7 +330,7 @@ API documentation for this library can be found on our [documentation site](http
|
|
|
356
330
|
|
|
357
331
|
### Client library support
|
|
358
332
|
|
|
359
|
-
Client and management libraries listed on the [Azure SDK releases page](https://azure.github.io/azure-sdk/releases/latest/js.html) that support
|
|
333
|
+
Client and management libraries listed on the [Azure SDK releases page](https://azure.github.io/azure-sdk/releases/latest/js.html) that support Microsoft Entra authentication accept credentials from this library. Learn more about using these libraries in their documentation, which is linked from the releases page.
|
|
360
334
|
|
|
361
335
|
### Known issues
|
|
362
336
|
|