Azure DevOps Services |Azure DevOps Server |Azure DevOps Server 2022
拡張機能でカスタム サービス エンドポイントの種類を定義するときは、HTTP 要求ヘッダーで資格情報を設定する方法を Azure DevOps に指示する認証スキームを指定します。 Azure DevOps では、カスタム エンドポイントに対して次の認証スキームがサポートされています。
ヒント
テーマ設定や VSS からの移行など、最新の拡張機能開発ガイダンスについて説明します。SDK については、 Azure DevOps Extension SDK 開発者ポータルを参照してください。
基本認証
Base64 でエンコードされた Authorization ヘッダーとして送信されたユーザー名とパスワードを使用します。
Important
可能であれば、基本認証の代わりにサービス プリンシパルとマネージド ID を使用します。 詳細については、「サービス プリンシパル & マネージド ID を使用する」を参照してください。
組み込みのスキームの種類は ms.vss-endpoint.endpoint-auth-scheme-basic。 拡張機能マニフェストで宣言する必要はありません。authenticationSchemes 配列でエンドポイントの種類を参照します。
"authenticationSchemes": [
{
"type": "ms.vss-endpoint.endpoint-auth-scheme-basic"
}
]
Azure DevOps はユーザーに ユーザー名 と パスワード の入力を求め、標準の HTTP Basic Authorization ヘッダーとして送信します。
トークン ベースの認証
単一の機密入力 (API トークン) を受け取ります。 トークン値は、 Authorization ヘッダーで送信されます。
{
"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
}
}
]
}
]
}
}
{{endpoint.apitoken}} プレースホルダーは、実行時にユーザーが API トークン フィールドに入力した値に解決されます。
証明書ベースの認証
1 つの機密入力 (テキスト領域に入力された証明書の内容) を受け取ります。
{
"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"
}
}