1
votes

I am developing Azure DevOps extension which contain service endpoint to hold secret ID/KEY. My requirement is to have endpoint just consist of Connection name, ID ,and Key in it.I have gone trough list of provided endpoints in Microsoft but I couldn't find suitable option to satisfy my requirement.

https://docs.microsoft.com/en-us/azure/devops/pipelines/library/service-endpoints?view=vsts#sep-ssh

closest solution I found is as below . But it contains input box for server URL(Which I need to omit (in this example though I don't define server URL it displays in popup dialog)). Please refer below image.

enter image description here

Is it possible to remove Server URL from above dialog box Or it there better endpoint type I can use for this requirement? please be kind enough to share some light with me.

1

1 Answers

3
votes

You'll need to create a custom service type, that will allow you to show/hide the individual text boxes. You can find an example in the Azure DevOps Extension Tasks which I maintain.

You define custom service endpoint types in the vss-extension.json along with your other extension points:

{
      "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
                }
              }
            ]
          }
        ]
      }
    },

You may find 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.