@azure/identity 3.3.0-alpha.20230811.1 → 3.3.0
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 +10 -63
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -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.
|
|
342
|
-
|
|
343
|
-
For example, using the `DefaultAzureCredential`:
|
|
344
|
-
|
|
345
|
-
```ts
|
|
346
|
-
import { setLogLevel } from "@azure/logger";
|
|
347
|
-
|
|
348
|
-
setLogLevel("info");
|
|
349
|
-
|
|
350
|
-
const credential = new DefaultAzureCredential({
|
|
351
|
-
loggingOptions: { allowLoggingAccountIdentifiers: true },
|
|
352
|
-
});
|
|
353
|
-
```
|
|
354
|
-
|
|
355
|
-
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 = new DefaultAzureCredential({
|
|
372
|
-
loggingOptions: { enableSupportLogging: true },
|
|
373
|
-
});
|
|
374
|
-
```
|
|
375
|
-
|
|
376
323
|
For assistance with troubleshooting, see the [troubleshooting guide](https://aka.ms/azsdk/js/identity/troubleshoot).
|
|
377
324
|
|
|
378
325
|
## Next steps
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azure/identity",
|
|
3
3
|
"sdk-type": "client",
|
|
4
|
-
"version": "3.3.0
|
|
4
|
+
"version": "3.3.0",
|
|
5
5
|
"description": "Provides credential implementations for Azure SDK libraries that can authenticate with Azure Active Directory",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist-esm/src/index.js",
|
|
@@ -123,10 +123,10 @@
|
|
|
123
123
|
},
|
|
124
124
|
"devDependencies": {
|
|
125
125
|
"@azure-tools/test-recorder": "^3.0.0",
|
|
126
|
-
"@azure/dev-tool": "
|
|
127
|
-
"@azure/eslint-plugin-azure-sdk": "
|
|
126
|
+
"@azure/dev-tool": "^1.0.0",
|
|
127
|
+
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
|
|
128
128
|
"@azure/keyvault-keys": "^4.2.0",
|
|
129
|
-
"@azure/test-utils": "
|
|
129
|
+
"@azure/test-utils": "^1.0.0",
|
|
130
130
|
"@microsoft/api-extractor": "^7.31.1",
|
|
131
131
|
"@types/chai": "^4.1.6",
|
|
132
132
|
"@types/jsonwebtoken": "^9.0.0",
|