Package com.azure.identity
Class AzurePipelinesCredentialBuilder
java.lang.Object
com.azure.identity.CredentialBuilderBase<AzurePipelinesCredentialBuilder>
com.azure.identity.AadCredentialBuilderBase<AzurePipelinesCredentialBuilder>
com.azure.identity.AzurePipelinesCredentialBuilder
- All Implemented Interfaces:
com.azure.core.client.traits.HttpTrait<AzurePipelinesCredentialBuilder>
public class AzurePipelinesCredentialBuilder
extends AadCredentialBuilderBase<AzurePipelinesCredentialBuilder>
The
AzurePipelinesCredentialBuilder
provides a fluent builder for AzurePipelinesCredential
.
// serviceConnectionId is retrieved from the portal. // systemAccessToken is retrieved from the pipeline environment as shown. // You may choose another name for this variable. String systemAccessToken = System.getenv("SYSTEM_ACCESSTOKEN"); AzurePipelinesCredential credential = new AzurePipelinesCredentialBuilder().clientId(clientId) .tenantId(tenantId) .serviceConnectionId(serviceConnectionId) .systemAccessToken(systemAccessToken) .build();
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds an instance of theAzurePipelinesCredential
with the current configurations.serviceConnectionId
(String serviceConnectionId) Sets the service connection id for the Azure Pipelines service connection.systemAccessToken
(String systemAccessToken) Sets the System Access Token for the Azure Pipelines service connection.tokenCachePersistenceOptions
(TokenCachePersistenceOptions tokenCachePersistenceOptions) Configures the persistent shared token cache options and enables the persistent token cache which is disabled by default.Methods inherited from class com.azure.identity.AadCredentialBuilderBase
additionallyAllowedTenants, additionallyAllowedTenants, authorityHost, clientId, disableInstanceDiscovery, enableUnsafeSupportLogging, executorService, tenantId
Methods inherited from class com.azure.identity.CredentialBuilderBase
addPolicy, clientOptions, configuration, enableAccountIdentifierLogging, httpClient, httpLogOptions, httpPipeline, maxRetry, pipeline, proxyOptions, retryOptions, retryPolicy, retryTimeout
-
Constructor Details
-
AzurePipelinesCredentialBuilder
public AzurePipelinesCredentialBuilder()Creates an instance of theAzurePipelinesCredentialBuilder
.
-
-
Method Details
-
serviceConnectionId
Sets the service connection id for the Azure Pipelines service connection. The service connection ID is retrieved from the Service Connection in the portal.- Parameters:
serviceConnectionId
- The service connection ID, as found in the query string's resourceId key.- Returns:
- the updated instance of the builder.
-
systemAccessToken
Sets the System Access Token for the Azure Pipelines service connection. The system access token is retrieved from the pipeline variables by assigning it to an environment variable and reading it. SeeAzurePipelinesCredential
for more information.- Parameters:
systemAccessToken
- the system access token for the Azure Pipelines service connection.- Returns:
- The updated instance of the builder.
-
tokenCachePersistenceOptions
public AzurePipelinesCredentialBuilder tokenCachePersistenceOptions(TokenCachePersistenceOptions tokenCachePersistenceOptions) Configures the persistent shared token cache options and enables the persistent token cache which is disabled by default. If configured, the credential will store tokens in a cache persisted to the machine, protected to the current user, which can be shared by other credentials and processes.- Parameters:
tokenCachePersistenceOptions
- the token cache configuration options- Returns:
- An updated instance of this builder with the token cache options configured.
-
build
Builds an instance of theAzurePipelinesCredential
with the current configurations. Requires setting the following parameters:- Client ID via
AadCredentialBuilderBase.clientId(String)
- Tenant ID via
AadCredentialBuilderBase.tenantId(String)
- Service Connection ID via
serviceConnectionId(String)
- System Access Token via
systemAccessToken(String)
SYSTEM_OIDCREQUESTURI
environment variable to be set.- Returns:
- an instance of the
AzurePipelinesCredential
. - Throws:
IllegalArgumentException
- Thrown when required parameters are set or the environment is not correctly configured.
- Client ID via
-