You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: sdk/identity/identity/CHANGELOG.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,9 @@
1
1
# Release History
2
2
3
-
## 3.3.0 (2023-08-10)
3
+
## 3.3.0 (2023-08-14)
4
4
5
5
### Features Added
6
-
- Enabled support for logging [personally identifiable information](https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/wiki/PII), required for customer support through the `enableSupportLogging` option on `loggingOptions` under `TokenCredentialOptions`.
6
+
- Enabled support for logging [personally identifiable information](https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/wiki/PII), required for customer support through the `enableUnsafeSupportLogging` option on `loggingOptions` under `TokenCredentialOptions`.
7
7
- Continuous Access Evaluation (CAE) is now configurable per-request by setting the `enable_cae` keyword argument to `True` in `get_token`. This applies to user credentials and service principal credentials. ([#26614](https://github.com/Azure/azure-sdk-for-js/pull/26614))
Copy file name to clipboardExpand all lines: sdk/identity/identity/README.md
+10-63Lines changed: 10 additions & 63 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -137,6 +137,12 @@ If used from Node.js, the `DefaultAzureCredential` will attempt to authenticate
137
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.
138
138
1.**Azure PowerShell** - If the developer has authenticated using the Azure PowerShell module `Connect-AzAccount` command, the `DefaultAzureCredential` will authenticate with that account.
139
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
+
140
146
#### Note about `VisualStudioCodeCredential`
141
147
142
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.
@@ -298,6 +304,10 @@ Not all credentials require this configuration. Credentials that authenticate th
298
304
299
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.
300
306
307
+
## Continuous Access Evaluation
308
+
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.
310
+
301
311
## Token caching
302
312
303
313
Token caching is a feature provided by the Azure Identity library that allows apps to:
@@ -310,69 +320,6 @@ The Azure Identity library offers both in-memory and persistent disk caching. Fo
310
320
311
321
## Troubleshooting
312
322
313
-
### Error handling
314
-
315
-
Credentials raise `AuthenticationError` when they fail to authenticate. This class has a `message` field which describes why authentication failed. An `AggregateAuthenticationError` will be raised by `ChainedTokenCredential` with an `errors` field containing an array of errors from each credential in the chain.
316
-
317
-
### Logging
318
-
319
-
Enabling logging may help uncover useful information about failures.
320
-
321
-
To see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`.
322
-
You can read this environment variable from the _.env_ file by explicitly specifying a file path:
323
-
324
-
```javascript
325
-
require("dotenv").config({ path:".env" });
326
-
```
327
-
328
-
Alternatively, logging can be enabled at runtime by calling `setLogLevel` from the `@azure/logger` package:
329
-
330
-
```typescript
331
-
import { setLogLevel } from"@azure/logger";
332
-
333
-
setLogLevel("info");
334
-
```
335
-
336
-
In cases where the authenticate code might be running in an environment with more than one credential available,
337
-
the `@azure/identity` package offers a unique form of logging. On the optional parameters for every credential,
338
-
developers can set `allowLoggingAccountIdentifiers` to true in the
339
-
`loggingOptions` to log information specific to the authenticated account after
340
-
each successful authentication, including the Client ID, the Tenant ID, the
341
-
Object ID of the authenticated user, and if possible the User Principal Name.
Once that credential authenticates, the following message will appear in the logs (with the real information instead of `HIDDEN`):
356
-
357
-
```
358
-
azure:identity:info [Authenticated account] Client ID: HIDDEN. Tenant ID: HIDDEN. User Principal Name: HIDDEN. Object ID (user): HIDDEN
359
-
```
360
-
361
-
In cases where the user's [Personally Identifiable Information](https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/wiki/PII) needs to be logged for customer support, developers can set `enableSupportLogging` to true in the
362
-
`loggingOptions`.
363
-
364
-
For example, using the `DefaultAzureCredential`:
365
-
366
-
```ts
367
-
import { setLogLevel } from"@azure/logger";
368
-
369
-
setLogLevel("info");
370
-
371
-
const credential =newDefaultAzureCredential({
372
-
loggingOptions: { enableSupportLogging: true },
373
-
});
374
-
```
375
-
376
323
For assistance with troubleshooting, see the [troubleshooting guide](https://aka.ms/azsdk/js/identity/troubleshoot).
Copy file name to clipboardExpand all lines: sdk/identity/identity/TOKEN_CACHING.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,6 +21,10 @@ The in-memory token cache provided by the Azure Identity library:
21
21
22
22
**Note:** When Azure Identity library credentials are used with Azure service libraries (for example, Azure Blob Storage), the in-memory token caching is active in the `HttpPipeline` layer as well. All `TokenCredential` implementations are supported there, including custom implementations external to the Azure Identity library.
23
23
24
+
#### Caching cannot be disabled
25
+
26
+
As there are many levels of cache, it's not possible disable in-memory caching. However, the in-memory cache may be cleared by creating a new credential instance.
27
+
24
28
### Persistent token caching
25
29
26
30
*Persistent disk token caching* is an opt-in feature in the Azure Identity library. The feature allows apps to cache access tokens in an encrypted, persistent storage mechanism. As indicated in the following table, the storage mechanism differs across operating systems.
@@ -31,11 +34,13 @@ This troubleshooting guide covers the following areas of the Azure Identity clie
31
34
32
35
## Handle Azure Identity errors
33
36
34
-
### AuthenticationRequiredError
37
+
### AggregateAuthenticationError
35
38
36
-
Errors arising from authentication issues can be thrown on any service client method that makes a request to the service. This is because the token is requested from the credential on the first call to the service and on any subsequent call that needs to refresh the token.
39
+
An `AggregateAuthenticationError` will be raised by `ChainedTokenCredential` with an `errors` field containing an array of errors from each credential in the chain.
37
40
38
-
To distinguish these failures from failures in the service client, Azure Identity classes throw the `AuthenticationRequiredError`. Details describing the source of the error are provided in the error message. Depending on the application, these errors may or may not be recoverable.
41
+
### AuthenticationError
42
+
43
+
The `AuthenticationError` is used to indicate a failure to authenticate with Azure Active Directory (Azure AD). The `errorResponse` field contains more details about the specific failure.
39
44
40
45
```ts
41
46
import*from"@azure/identity";
@@ -51,20 +56,18 @@ async function main() {
51
56
// Retrieving the properties of the existing keys in that specific Key Vault.
console.log("Azure Active Directory service response with error", error.errorResponse);
55
60
}
56
61
}
57
62
58
63
main();
59
64
```
60
65
61
-
### CredentialUnavailableError
62
-
63
-
The `CredentialUnavailableError` is used to indicate that the credential can't authenticate in the current environment due to lack of required configuration or setup. This error is also used as a signal to chained credential types, such as `DefaultAzureCredential` and `ChainedTokenCredential`, that the chained credential should continue to try other credential types later in the chain. In `ManagedIdentityCredential`, it can also trigger if the authentication endpoint (like the IMDS endpoint) is unavailable.
66
+
### AuthenticationRequiredError
64
67
65
-
### AuthenticationError
68
+
Errors arising from authentication issues can be thrown on any service client method that makes a request to the service. This is because the token is requested from the credential on the first call to the service and on any subsequent call that needs to refresh the token.
66
69
67
-
The `AuthenticationError` is used to indicate a failure to authenticate with Azure Active Directory (Azure AD). The `errorResponse` field contains more details about the specific failure.
70
+
To distinguish these failures from failures in the service client, Azure Identity classes throw the `AuthenticationRequiredError`. Details describing the source of the error are provided in the error message. Depending on the application, these errors may or may not be recoverable.
68
71
69
72
```ts
70
73
import*from"@azure/identity";
@@ -80,13 +83,17 @@ async function main() {
80
83
// Retrieving the properties of the existing keys in that specific Key Vault.
The `CredentialUnavailableError` is used to indicate that the credential can't authenticate in the current environment due to lack of required configuration or setup. This error is also used as a signal to chained credential types, such as `DefaultAzureCredential` and `ChainedTokenCredential`, that the chained credential should continue to try other credential types later in the chain. In `ManagedIdentityCredential`, it can also trigger if the authentication endpoint (like the IMDS endpoint) is unavailable.
96
+
90
97
## Find relevant information in error messages
91
98
92
99
`AuthenticationRequiredError` is thrown when unexpected errors occurred while a credential is authenticating. This can include errors received from requests to the Azure AD Security Token Service (STS) and often contains information helpful to diagnosis. Consider the following `AuthenticationRequiredError` message:
@@ -117,6 +124,13 @@ import { setLogLevel } from "@azure/logger";
117
124
setLogLevel("info");
118
125
```
119
126
127
+
Alternatively, you can 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:
128
+
129
+
```ts
130
+
importdotenvfrom"dotenv";
131
+
dotenv.config({path: ".env"});
132
+
```
133
+
120
134
Consider a scenario in which you have the following environment variables set up either in your environment or _.env_ file:
121
135
122
136
-`AZURE_TENANT_ID`
@@ -134,6 +148,44 @@ These logging statements indicate that the `EnvironmentCredential` is being used
134
148
135
149
> CAUTION: Requests and responses in the Azure Identity library contain sensitive information. Precaution must be taken to protect logs when customizing the output to avoid compromising account security.
136
150
151
+
#### Allow logging identifiers
152
+
153
+
In cases where the authentication code might be running in an environment with more than one credential available, the `@azure/identity` package offers a unique form of logging. On the optional parameters for every credential, developers can set `allowLoggingAccountIdentifiers` to `true` in the `loggingOptions` to log information specific to the authenticated account after each successful authentication, including the Client ID, the Tenant ID, the Object ID of the authenticated user, and, if possible, the User Principal Name.
Once that credential authenticates, the following message will appear in the logs (with the real information instead of `HIDDEN`):
168
+
169
+
```
170
+
azure:identity:info [Authenticated account] Client ID: HIDDEN. Tenant ID: HIDDEN. User Principal Name: HIDDEN. Object ID (user): HIDDEN
171
+
```
172
+
173
+
#### PII logging
174
+
175
+
In cases where the user's [Personally Identifiable Information](https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/wiki/PII) needs to be logged for customer support, developers can set `enableUnsafeSupportLogging` to `true` in the `loggingOptions`.
If you're using app registration to authenticate the service, ensure the app registration has the correct permissions and role assignments in the service you want to use. For example, if you want to have access to the Azure App Configuration service through Azure AD, ensure your app registration has the permissions and role assignments for access to Azure AD. You can either be assigned the role directly or be in a group that's assigned the role. The "Contributor" and the "Owner" roles allow you to manage the App Configuration resource. In this case, you can either use "App Configuration Data Owner" directly on the user or the Azure AD group. Alternatively, use "Owner" on the Azure AD group. While the App Configuration data can be accessed using access keys, these keys don't grant direct access to the data using Azure AD.
0 commit comments