@azure/identity 4.5.0-alpha.20240820.1 → 4.5.0-alpha.20240823.1

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -305,7 +305,6 @@ const AuthenticationErrorName = "AuthenticationError";
305
305
  * the specific failure.
306
306
  */
307
307
  class AuthenticationError extends Error {
308
- // eslint-disable-next-line @typescript-eslint/ban-types
309
308
  constructor(statusCode, errorBody, options) {
310
309
  let errorResponse = {
311
310
  error: "unknown",
@@ -2174,9 +2173,11 @@ class MsalMsiProvider {
2174
2173
  _options = clientIdOrOptions !== null && clientIdOrOptions !== void 0 ? clientIdOrOptions : {};
2175
2174
  }
2176
2175
  this.resourceId = _options === null || _options === void 0 ? void 0 : _options.resourceId;
2176
+ this.objectId = _options === null || _options === void 0 ? void 0 : _options.objectId;
2177
2177
  // For JavaScript users.
2178
- if (this.clientId && this.resourceId) {
2179
- throw new Error(`ManagedIdentityCredential - Client Id and Resource Id can't be provided at the same time.`);
2178
+ const providedIds = [this.clientId, this.resourceId, this.objectId].filter(Boolean);
2179
+ if (providedIds.length > 1) {
2180
+ throw new Error(`ManagedIdentityCredential - only one of 'clientId', 'resourceId', or 'objectId' can be provided. Received values: ${JSON.stringify({ clientId: this.clientId, resourceId: this.resourceId, objectId: this.objectId })}`);
2180
2181
  }
2181
2182
  // ManagedIdentity uses http for local requests
2182
2183
  _options.allowInsecureConnection = true;
@@ -2188,6 +2189,7 @@ class MsalMsiProvider {
2188
2189
  managedIdentityIdParams: {
2189
2190
  userAssignedClientId: this.clientId,
2190
2191
  userAssignedResourceId: this.resourceId,
2192
+ userAssignedObjectId: this.objectId,
2191
2193
  },
2192
2194
  system: {
2193
2195
  // todo: proxyUrl?