@azure/identity 2.1.0-alpha.20220419.3 → 2.1.0-alpha.20220426.1
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 +1 -0
- package/README.md +7 -7
- package/dist/index.js +11 -11
- package/dist/index.js.map +1 -1
- package/dist-esm/src/credentials/azureCliCredential.js +5 -4
- package/dist-esm/src/credentials/azureCliCredential.js.map +1 -1
- package/dist-esm/src/credentials/defaultAzureCredential.js +3 -3
- package/dist-esm/src/credentials/defaultAzureCredential.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/index.js +3 -4
- package/dist-esm/src/credentials/managedIdentityCredential/index.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -120,12 +120,12 @@ If used from Node.js, the `DefaultAzureCredential` will attempt to authenticate
|
|
|
120
120
|
|
|
121
121
|
![DefaultAzureCredential authentication flow][defaultauthflow_image]
|
|
122
122
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
123
|
+
1. **Environment** - The `DefaultAzureCredential` will read account information specified via [environment variables](#environment-variables) and use it to authenticate.
|
|
124
|
+
1. **Managed Identity** - If the application is deployed to an Azure host with Managed Identity enabled, the `DefaultAzureCredential` will authenticate with that account.
|
|
125
|
+
1. **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.
|
|
126
|
+
- In `@azure/identity` version 2.0 or later, the [`@azure/identity-vscode`](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity-vscode) package must be installed for the Visual Studio Code authentication to work.
|
|
127
|
+
1. **Azure CLI** - If the developer has authenticated an account via the Azure CLI `az login` command, the `DefaultAzureCredential` will authenticate with that account.
|
|
128
|
+
1. **Azure PowerShell** - If the developer has authenticated using the Azure PowerShell module `Connect-AzAccount` command, the `DefaultAzureCredential` will authenticate with that account.
|
|
129
129
|
|
|
130
130
|
## Plugins
|
|
131
131
|
|
|
@@ -366,6 +366,6 @@ If you'd like to contribute to this library, please read the [contributing guide
|
|
|
366
366
|
[azureclilogin_image]: https://raw.githubusercontent.com/Azure/azure-sdk-for-js/main/sdk/identity/identity/images/AzureCliLogin.png
|
|
367
367
|
[azureclilogindevicecode_image]: https://raw.githubusercontent.com/Azure/azure-sdk-for-js/main/sdk/identity/identity/images/AzureCliLoginDeviceCode.png
|
|
368
368
|
[azurepowershelllogin_image]: https://raw.githubusercontent.com/Azure/azure-sdk-for-js/main/sdk/identity/identity/images/AzurePowerShellLogin.png
|
|
369
|
-
[defaultauthflow_image]: https://raw.githubusercontent.com/Azure/azure-sdk-for-js/main/sdk/identity/identity/images/
|
|
369
|
+
[defaultauthflow_image]: https://raw.githubusercontent.com/Azure/azure-sdk-for-js/main/sdk/identity/identity/images/mermaidjs/DefaultAzureCredentialAuthFlow.svg
|
|
370
370
|
|
|
371
371
|

|
package/dist/index.js
CHANGED
|
@@ -1542,13 +1542,14 @@ class AzureCliCredential {
|
|
|
1542
1542
|
ensureValidScope(scope, logger$h);
|
|
1543
1543
|
const resource = getScopeResource(scope);
|
|
1544
1544
|
return tracingClient.withSpan(`${this.constructor.name}.getToken`, options, async () => {
|
|
1545
|
-
var _a, _b, _c;
|
|
1545
|
+
var _a, _b, _c, _d;
|
|
1546
1546
|
try {
|
|
1547
1547
|
const obj = await cliCredentialInternals.getAzureCliAccessToken(resource, tenantId);
|
|
1548
|
-
const
|
|
1549
|
-
const
|
|
1548
|
+
const specificScope = (_a = obj.stderr) === null || _a === void 0 ? void 0 : _a.match("(.*)az login --scope(.*)");
|
|
1549
|
+
const isLoginError = ((_b = obj.stderr) === null || _b === void 0 ? void 0 : _b.match("(.*)az login(.*)")) && !specificScope;
|
|
1550
|
+
const isNotInstallError = ((_c = obj.stderr) === null || _c === void 0 ? void 0 : _c.match("az:(.*)not found")) || ((_d = obj.stderr) === null || _d === void 0 ? void 0 : _d.startsWith("'az' is not recognized"));
|
|
1550
1551
|
if (isNotInstallError) {
|
|
1551
|
-
const error = new CredentialUnavailableError("Azure CLI could not be found.
|
|
1552
|
+
const error = new CredentialUnavailableError("Azure CLI could not be found. Please visit https://aka.ms/azure-cli for installation instructions and then, once installed, authenticate to your Azure account using 'az login'.");
|
|
1552
1553
|
logger$h.getToken.info(formatError(scopes, error));
|
|
1553
1554
|
throw error;
|
|
1554
1555
|
}
|
|
@@ -2878,7 +2879,6 @@ class ManagedIdentityCredential {
|
|
|
2878
2879
|
* @hidden
|
|
2879
2880
|
*/
|
|
2880
2881
|
constructor(clientIdOrOptions, options) {
|
|
2881
|
-
var _a, _b;
|
|
2882
2882
|
this.isEndpointUnavailable = null;
|
|
2883
2883
|
let _options;
|
|
2884
2884
|
if (typeof clientIdOrOptions === "string") {
|
|
@@ -2886,10 +2886,10 @@ class ManagedIdentityCredential {
|
|
|
2886
2886
|
_options = options;
|
|
2887
2887
|
}
|
|
2888
2888
|
else {
|
|
2889
|
-
this.clientId =
|
|
2889
|
+
this.clientId = clientIdOrOptions === null || clientIdOrOptions === void 0 ? void 0 : clientIdOrOptions.clientId;
|
|
2890
2890
|
_options = clientIdOrOptions;
|
|
2891
2891
|
}
|
|
2892
|
-
this.resourceId =
|
|
2892
|
+
this.resourceId = _options === null || _options === void 0 ? void 0 : _options.resourceId;
|
|
2893
2893
|
// For JavaScript users.
|
|
2894
2894
|
if (this.clientId && this.resourceId) {
|
|
2895
2895
|
throw new Error(`${ManagedIdentityCredential.name} - Client Id and Resource Id can't be provided at the same time.`);
|
|
@@ -2904,11 +2904,11 @@ class ManagedIdentityCredential {
|
|
|
2904
2904
|
return this.cachedMSI;
|
|
2905
2905
|
}
|
|
2906
2906
|
const MSIs = [
|
|
2907
|
+
arcMsi,
|
|
2907
2908
|
fabricMsi,
|
|
2908
2909
|
appServiceMsi2019,
|
|
2909
2910
|
appServiceMsi2017,
|
|
2910
2911
|
cloudShellMsi,
|
|
2911
|
-
arcMsi,
|
|
2912
2912
|
tokenExchangeMsi(),
|
|
2913
2913
|
imdsMsi,
|
|
2914
2914
|
];
|
|
@@ -3056,9 +3056,9 @@ class DefaultManagedIdentityCredential extends ManagedIdentityCredential {
|
|
|
3056
3056
|
// Constructor overload with just the other default options
|
|
3057
3057
|
// Last constructor overload with Union of all options not required since the above two constructor overloads have optional properties
|
|
3058
3058
|
constructor(options) {
|
|
3059
|
-
var _a
|
|
3060
|
-
const managedIdentityClientId = (
|
|
3061
|
-
const managedResourceId =
|
|
3059
|
+
var _a;
|
|
3060
|
+
const managedIdentityClientId = (_a = options === null || options === void 0 ? void 0 : options.managedIdentityClientId) !== null && _a !== void 0 ? _a : process.env.AZURE_CLIENT_ID;
|
|
3061
|
+
const managedResourceId = options === null || options === void 0 ? void 0 : options.managedIdentityResourceId;
|
|
3062
3062
|
// ManagedIdentityCredential throws if both the resourceId and the clientId are provided.
|
|
3063
3063
|
if (managedResourceId) {
|
|
3064
3064
|
const managedIdentityResourceIdOptions = Object.assign(Object.assign({}, options), { resourceId: managedResourceId });
|