Skip to content


This library provides a thin wrapper around the @azure/identity library to make it easy to integrate Azure Identity authentication in your solution.

You will first need to install the package:

npm install @pnp/azidjsclient --save

The following example shows how to configure the SPFI or GraphFI object using this behavior.

import { DefaultAzureCredential } from "@azure/identity";
import { spfi } from "@pnp/sp";
import { graphfi } from "@pnp/sp";
import { SPDefault, GraphDefault } from "@pnp/nodejs";
import { AzureIdentity } from "@pnp/azidjsclient";
import "@pnp/sp/webs";
import "@pnp/graph/me";

const credential = new DefaultAzureCredential();

const sp = spfi("").using(
    AzureIdentity(credential, [`https://${tenant}`], null)

const graph = graphfi().using(
    AzureIdentity(credential, [""], null)

const webData = await sp.web();
const meData = await;

Please see more scenarios in the authentication article.