AzurePipelinesCredentialBuilder Class
- java.
lang. Object - com.
azure. identity. CredentialBuilderBase<T> - com.
azure. identity. AadCredentialBuilderBase<T> - com.
azure. identity. AzurePipelinesCredentialBuilder
- com.
- com.
- com.
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
Constructor | Description |
---|---|
AzurePipelinesCredentialBuilder() |
Creates an instance of the AzurePipelinesCredentialBuilder. |
Method Summary
Modifier and Type | Method and Description |
---|---|
Azure |
build()
Builds an instance of the AzurePipelinesCredential with the current configurations. |
Azure |
serviceConnectionId(String serviceConnectionId)
Sets the service connection id for the Azure Pipelines service connection. |
Azure |
systemAccessToken(String systemAccessToken)
Sets the System Access Token for the Azure Pipelines service connection. |
Azure |
tokenCachePersistenceOptions(TokenCachePersistenceOptions tokenCachePersistenceOptions)
Configures the persistent shared token cache options and enables the persistent token cache which is disabled by default. |
Methods inherited from AadCredentialBuilderBase
Methods inherited from CredentialBuilderBase
Methods inherited from java.lang.Object
Constructor Details
AzurePipelinesCredentialBuilder
public AzurePipelinesCredentialBuilder()
Creates an instance of the AzurePipelinesCredentialBuilder.
Method Details
build
public AzurePipelinesCredential build()
Builds an instance of the AzurePipelinesCredential with the current configurations. Requires setting the following parameters:
- Client ID via #clientId(String)
- Tenant ID via #tenantId(String)
- Service Connection ID via serviceConnectionId(String serviceConnectionId)
- System Access Token via systemAccessToken(String systemAccessToken)
Requires the SYSTEM_OIDCREQUESTURI
environment variable to be set.
Returns:
serviceConnectionId
public AzurePipelinesCredentialBuilder serviceConnectionId(String 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:
Returns:
systemAccessToken
public AzurePipelinesCredentialBuilder systemAccessToken(String 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. See AzurePipelinesCredential for more information.
Parameters:
Returns:
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:
Returns: