Package version:
Creates an instance of the OnBehalfOfCredential with the details needed to authenticate against Microsoft Entra ID with path to a PEM certificate, and an user assertion.
Example using the KeyClient from @azure/keyvault-keys:
import { OnBehalfOfCredential } from "@azure/identity";
import { KeyClient } from "@azure/keyvault-keys";
const tokenCredential = new OnBehalfOfCredential({
tenantId: "tenant-id",
clientId: "client-id",
certificatePath: "/path/to/certificate.pem",
userAssertionToken: "access-token",
});
const client = new KeyClient("vault-url", tokenCredential);
await client.getKey("key-name");
Optional parameters, generally common across credentials.
Creates an instance of the OnBehalfOfCredential with the details needed to authenticate against Microsoft Entra ID with a client secret and an user assertion.
Example using the KeyClient from @azure/keyvault-keys:
import { OnBehalfOfCredential } from "@azure/identity";
import { KeyClient } from "@azure/keyvault-keys";
const tokenCredential = new OnBehalfOfCredential({
tenantId: "tenant-id",
clientId: "client-id",
clientSecret: "client-secret",
userAssertionToken: "access-token",
});
const client = new KeyClient("vault-url", tokenCredential);
await client.getKey("key-name");
Optional parameters, generally common across credentials.
Creates an instance of the OnBehalfOfCredential with the details
needed to authenticate against Microsoft Entra ID with a client getAssertion
and an user assertion.
Example using the KeyClient from @azure/keyvault-keys:
import { OnBehalfOfCredential } from "@azure/identity";
import { KeyClient } from "@azure/keyvault-keys";
const tokenCredential = new OnBehalfOfCredential({
tenantId: "tenant-id",
clientId: "client-id",
getAssertion: () => {
return Promise.resolve("my-jwt");
},
userAssertionToken: "access-token",
});
const client = new KeyClient("vault-url", tokenCredential);
await client.getKey("key-name");
Optional parameters, generally common across credentials.
Authenticates with Microsoft Entra ID and returns an access token if successful. If authentication fails, a CredentialUnavailableError will be thrown with the details of the failure.
The list of scopes for which the token will have access.
The options used to configure the underlying network requests.
Enables authentication to Microsoft Entra ID using the On Behalf Of flow.