你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
AzurePipelinesCredential class
This credential is designed to be used in Azure Pipelines with service connections as a setup for workload identity federation.
Constructors
Azure |
AzurePipelinesCredential supports Federated Identity on Azure Pipelines through Service Connections. |
Methods
get |
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>