ID/KEY 的 Azure DevOps 扩展自定义服务端点
Azure DevOps Extension custom service endopint for ID/KEY
我正在开发 Azure DevOps 扩展,其中包含要保密的服务端点 ID/KEY。我的要求是端点仅由连接名称、ID 和 it.I 中的密钥组成,已通过 Microsoft 提供的端点列表,但我找不到合适的选项来满足我的要求。
https://docs.microsoft.com/en-us/azure/devops/pipelines/library/service-endpoints?view=vsts#sep-ssh
我找到的最接近的解决方案如下。但它包含服务器 URL 的输入框(我需要省略(在这个例子中,虽然我没有定义服务器 URL 它显示在弹出对话框中))。请参考下图。
是否可以从上面的对话框中删除服务器 URL 或者我可以使用更好的端点类型来满足此要求?请善待与我分享一些光。
您需要创建一个自定义服务类型,这样您就可以 show/hide 各个文本框。你可以 find an example in the Azure DevOps Extension Tasks which I maintain.
您在 vss-extension.json
中定义自定义服务端点类型以及其他扩展点:
{
"id": "vsts-marketplace-endpoint-type",
"type": "ms.vss-endpoint.service-endpoint-type",
"targets": [
"ms.vss-endpoint.endpoint-types"
],
"properties": {
"name": "VstsMarketplacePublishing",
"displayName": "Visual Studio Marketplace",
"url": {
"displayName": "Marketplace URL",
"value": "https://marketplace.visualstudio.com",
"isVisible": "false"
},
"helpMarkDown": "Required permissions: <ul><li><b>Publish</b>: All accessible organisations, Marketplace (Publish)</li><li><b>Share</b>: All accessible organisations, Marketplace Publish</li><li><b>Install</b>: All accessible organisations or a specific organisation, Extensions (read and manage), Marketplace (acquire)</li><li><b>Query Version</b>: All accessible organisations, Marketplace (read)</li><li><b>Is Valid Extension</b>: All accessible organisations, Marketplace (read)</li></ul><br/><a href='https://www.visualstudio.com/docs/setup-admin/team-services/use-personal-access-tokens-to-authenticate'>More information</a>.",
"authenticationSchemes": [
{
"type": "ms.vss-endpoint.endpoint-auth-scheme-basic",
"inputDescriptors": [
{
"id": "username",
"name": "Username",
"description": "Username",
"inputMode": "textbox",
"isConfidential": false,
"validation": {
"isRequired": false,
"dataType": "string",
"maxLength": 300
},
"values": {
"inputId": "username",
"isDisabled": true,
"defaultValue": ""
}
},
{
"id": "password",
"name": "Personal access token",
"description": "Azure DevOps personal access token.",
"inputMode": "passwordbox",
"isConfidential": true,
"validation": {
"isRequired": true,
"dataType": "string",
"maxLength": 300
}
}
]
}
]
}
},
您可能会发现 other extensions that set or configure the authentication dialog on GitHub, there are quite a few. Useful docs are here in an old blog post。
我正在开发 Azure DevOps 扩展,其中包含要保密的服务端点 ID/KEY。我的要求是端点仅由连接名称、ID 和 it.I 中的密钥组成,已通过 Microsoft 提供的端点列表,但我找不到合适的选项来满足我的要求。
https://docs.microsoft.com/en-us/azure/devops/pipelines/library/service-endpoints?view=vsts#sep-ssh
我找到的最接近的解决方案如下。但它包含服务器 URL 的输入框(我需要省略(在这个例子中,虽然我没有定义服务器 URL 它显示在弹出对话框中))。请参考下图。
是否可以从上面的对话框中删除服务器 URL 或者我可以使用更好的端点类型来满足此要求?请善待与我分享一些光。
您需要创建一个自定义服务类型,这样您就可以 show/hide 各个文本框。你可以 find an example in the Azure DevOps Extension Tasks which I maintain.
您在 vss-extension.json
中定义自定义服务端点类型以及其他扩展点:
{
"id": "vsts-marketplace-endpoint-type",
"type": "ms.vss-endpoint.service-endpoint-type",
"targets": [
"ms.vss-endpoint.endpoint-types"
],
"properties": {
"name": "VstsMarketplacePublishing",
"displayName": "Visual Studio Marketplace",
"url": {
"displayName": "Marketplace URL",
"value": "https://marketplace.visualstudio.com",
"isVisible": "false"
},
"helpMarkDown": "Required permissions: <ul><li><b>Publish</b>: All accessible organisations, Marketplace (Publish)</li><li><b>Share</b>: All accessible organisations, Marketplace Publish</li><li><b>Install</b>: All accessible organisations or a specific organisation, Extensions (read and manage), Marketplace (acquire)</li><li><b>Query Version</b>: All accessible organisations, Marketplace (read)</li><li><b>Is Valid Extension</b>: All accessible organisations, Marketplace (read)</li></ul><br/><a href='https://www.visualstudio.com/docs/setup-admin/team-services/use-personal-access-tokens-to-authenticate'>More information</a>.",
"authenticationSchemes": [
{
"type": "ms.vss-endpoint.endpoint-auth-scheme-basic",
"inputDescriptors": [
{
"id": "username",
"name": "Username",
"description": "Username",
"inputMode": "textbox",
"isConfidential": false,
"validation": {
"isRequired": false,
"dataType": "string",
"maxLength": 300
},
"values": {
"inputId": "username",
"isDisabled": true,
"defaultValue": ""
}
},
{
"id": "password",
"name": "Personal access token",
"description": "Azure DevOps personal access token.",
"inputMode": "passwordbox",
"isConfidential": true,
"validation": {
"isRequired": true,
"dataType": "string",
"maxLength": 300
}
}
]
}
]
}
},
您可能会发现 other extensions that set or configure the authentication dialog on GitHub, there are quite a few. Useful docs are here in an old blog post。