From 059fc3c1da245b39c76abcbec0da7d7200a1bbf1 Mon Sep 17 00:00:00 2001 From: Slawomir Koszewski Date: Tue, 10 Mar 2026 20:28:41 +0100 Subject: [PATCH] fix: update getAzureIdentityAuthProvider and make tenant id and client id optional. --- src/graph/auth.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/graph/auth.ts b/src/graph/auth.ts index 7ba86f3..e16c5ae 100644 --- a/src/graph/auth.ts +++ b/src/graph/auth.ts @@ -32,14 +32,15 @@ export function getMsalAuthProvider( }; } -export function getAzureIdentityAuthProvider( - tenantId: string, - clientId: string, -) { - const credential = new DefaultAzureCredential({ - tenantId, - managedIdentityClientId: clientId, - }); +export function getAzureIdentityAuthProvider(tenantId?: string, clientId?: string) : GraphAuthProvider { + const credentialOptions = + tenantId && clientId + ? { tenantId, managedIdentityClientId: clientId } + : undefined; + + const credential = credentialOptions + ? new DefaultAzureCredential(credentialOptions) + : new DefaultAzureCredential(); const getBearerToken = getBearerTokenProvider( credential,