服务终结点身份验证方案
Azure DevOps Services |Azure DevOps Server 2022 - Azure DevOps Server 2019
了解如何在调用外部终结点时在 HTTP 请求标头中设置凭据。 然后,Azure DevOps 可以使用凭据连接到外部服务。 Azure DevOps 支持自定义服务终结点类型使用的一组封闭式身份验证方案。 Azure DevOps 将解释任何自定义终结点和外部服务支持连接中使用的身份验证方案。
请参阅以下属于封闭集合的身份验证方案。
小贴士
查看我们使用 Azure DevOps Extension SDK开发的最新扩展文档。
基本身份验证
作为安全措施,我们建议使用服务主体和托管标识,而不是基本身份验证。 有关详细信息,请参阅使用服务主体和托管标识。
基于令牌的身份验证
此方案采用一个输入 - API 令牌(机密)
使用的默认身份验证标头为:{{endpoint.apitoken}}
{
"id": "endpoint-auth-scheme-token",
"description": "i18n:Token based endpoint authentication scheme",
"type": "ms.vss-endpoint.service-endpoint-type",
"targets": [
"ms.vss-endpoint.endpoint-types"
],
"properties": {
"name": "Token",
"displayName": "i18n:Token Based Authentication",
"authenticationSchemes": [
{
"type": "ms.vss-endpoint.endpoint-auth-scheme-token",
"headers": [
{
"name": "Authorization",
"value": "{{endpoint.apitoken}}"
}
],
"inputDescriptors": [
{
"id": "apitoken",
"name": "i18n:API Token",
"description": "i18n:API Token for connection to endpoint",
"inputMode": "textbox",
"isConfidential": true,
"validation": {
"isRequired": true,
"dataType": "string",
"maxLength": 300
}
}
]
}
]
}
}
基于证书的身份验证
此方案采用一个输入 - 证书(机密)
必须在文本区域中提供证书的值。
{
"id": "endpoint-auth-scheme-cert",
"description": "i18n:Creates a certificate-based endpoint authentication scheme",
"type": "ms.vss-endpoint.service-endpoint-type",
"targets": [
"ms.vss-endpoint.endpoint-types"
],
"properties": {
"name": "Certificate",
"displayName": "i18n:Certificate Based",
"authenticationSchemes": [
{
"type": "ms.vss-endpoint.endpoint-auth-scheme-cert",
"inputDescriptors": [
{
"id": "certificate",
"name": "i18n:Certificate",
"description": "Content of the certificate",
"inputMode": "TextArea",
"isConfidential": true,
"validation": {
"isRequired": true,
"dataType": "string"
}
}
]
}
]
}
}
无身份验证
当终结点类型不需要采用任何输入时,将使用此方案。 例如,支持匿名访问其资源的外部服务。
{
"id": "endpoint-auth-scheme-none",
"description": "i18n:Creates an endpoint authentication scheme with no authentication.",
"type": "ms.vss-endpoint.endpoint-auth-scheme-none",
"targets": [
"ms.vss-endpoint.endpoint-auth-schemes"
],
"properties": {
"name": "None",
"displayName": "i18n:No Authentication"
}
}