Sdílet prostřednictvím


AzurePipelinesCredential class

This credential is designed to be used in Azure Pipelines with service connections as a setup for workload identity federation.

Constructors

AzurePipelinesCredential(string, string, string, string, AzurePipelinesCredentialOptions)

AzurePipelinesCredential supports Federated Identity on Azure Pipelines through Service Connections.

Methods

getToken(string | string[], GetTokenOptions)

Authenticates with Microsoft Entra ID and returns an access token if successful. If authentication fails, a CredentialUnavailableError or AuthenticationError will be thrown with the details of the failure.

Constructor Details

AzurePipelinesCredential(string, string, string, string, AzurePipelinesCredentialOptions)

AzurePipelinesCredential supports Federated Identity on Azure Pipelines through Service Connections.

new AzurePipelinesCredential(tenantId: string, clientId: string, serviceConnectionId: string, systemAccessToken: string, options?: AzurePipelinesCredentialOptions)

Parameters

tenantId

string

tenantId associated with the service connection

clientId

string

clientId associated with the service connection

serviceConnectionId

string

Unique ID for the service connection, as found in the querystring's resourceId key

systemAccessToken

string

The pipeline's System.AccessToken value.

options
AzurePipelinesCredentialOptions

The identity client options to use for authentication.

Method Details

getToken(string | string[], GetTokenOptions)

Authenticates with Microsoft Entra ID and returns an access token if successful. If authentication fails, a CredentialUnavailableError or AuthenticationError will be thrown with the details of the failure.

function getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken>

Parameters

scopes

string | string[]

The list of scopes for which the token will have access.

options
GetTokenOptions

The options used to configure any requests this TokenCredential implementation might make.

Returns

Promise<AccessToken>