Table of Contents

Class AzurePipelinesCredential

Namespace
Azure.Identity
Assembly
Azure.Identity.dll

Credential which authenticates using an Azure Pipelines service connection.

public class AzurePipelinesCredential : TokenCredential
Inheritance
AzurePipelinesCredential

Constructors

AzurePipelinesCredential()

Protected constructor for mocking.

protected AzurePipelinesCredential()

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

Creates a new instance of the AzurePipelinesCredential.

public AzurePipelinesCredential(string tenantId, string clientId, string serviceConnectionId, string systemAccessToken, AzurePipelinesCredentialOptions options = null)

Parameters

tenantId string

The tenant ID for the service connection.

clientId string

The client ID for the service connection.

serviceConnectionId string

The service connection Id for the service connection associated with the pipeline.

systemAccessToken string

The pipeline's System.AccessToken value.

options AzurePipelinesCredentialOptions

An instance of AzurePipelinesCredentialOptions.

Exceptions

ArgumentNullException

When systemAccessToken is null.

Methods

GetToken(TokenRequestContext, CancellationToken)

Gets an Azure.Core.AccessToken for the specified set of scopes.

public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken)

Parameters

requestContext TokenRequestContext

The Azure.Core.TokenRequestContext with authentication information.

cancellationToken CancellationToken

The CancellationToken to use.

Returns

AccessToken

A valid Azure.Core.AccessToken.

Remarks

Caching and management of the lifespan for the Azure.Core.AccessToken is considered the responsibility of the caller: each call should request a fresh token being requested.

GetTokenAsync(TokenRequestContext, CancellationToken)

Gets an Azure.Core.AccessToken for the specified set of scopes.

public override ValueTask<AccessToken> GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken)

Parameters

requestContext TokenRequestContext

The Azure.Core.TokenRequestContext with authentication information.

cancellationToken CancellationToken

The CancellationToken to use.

Returns

ValueTask<AccessToken>

A valid Azure.Core.AccessToken.

Remarks

Caching and management of the lifespan for the Azure.Core.AccessToken is considered the responsibility of the caller: each call should request a fresh token being requested.