Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions templates/vsc/ts/graph-connector/src/graphClient.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DefaultAzureCredential } from "@azure/identity";
import { ClientSecretCredential } from "@azure/identity";
import { Client, MiddlewareFactory } from "@microsoft/microsoft-graph-client";
import { TokenCredentialAuthenticationProvider } from "@microsoft/microsoft-graph-client/authProviders/azureTokenCredentials/index.js";
import { LongRunningOperationMiddleware } from "./longRunningOperationMiddleware";
Expand All @@ -10,9 +10,11 @@ const delayInterval = 60_000; // 60 seconds
* @returns A new instance of the Microsoft Graph client.
*/
export function getClient(): Client {
const credential = new DefaultAzureCredential({
requiredEnvVars: ["AZURE_TOKEN_CREDENTIALS"],
});
const credential = new ClientSecretCredential(
process.env.AZURE_TENANT_ID!,
process.env.AZURE_CLIENT_ID!,
process.env.AZURE_CLIENT_SECRET!
);

const authProvider = new TokenCredentialAuthenticationProvider(credential, {
scopes: ["https://graph.microsoft.com/.default"],
Expand Down
Loading