VSTS create service connection via API

后端 未结 1 353
眼角桃花
眼角桃花 2021-01-22 18:18

I\'m trying to create a service connection using the Azure DevOps API. This is the reference I\'m using:

MS Docs VSTS Endpoints - Create

I\'ve build the request

相关标签:
1条回答
  • 2021-01-22 19:02

    The simple way to check the detail request is capture the actual request of creating target service endpoint manually (Fiddler or F12 developer tool)

    The sample REST API to create kubernetes service endpoint:

    Post https://dev.azure.com/{organization}/{project}/_apis/serviceendpoint/endpoints?api-version=5.0-preview.2
    

    Body:

    {
    
        "description": "",
        "administratorsGroup": null,
        "authorization": {
            "parameters": {
                "kubeconfig": "apiVersion: v1
    kind: Config
    clusters:
    - name: local
      cluster:
        insecure-skip-tls-verify: true
        server: https://192.168.43.66:6443
    contexts:
    - context:
        cluster: local
        user: admin
      name: kubelet-context
    current-context: kubelet-context
    users:
    - name: admin
      user:
        password: admin
        username: admin",
                "username": "admin",
                "password": "admin"
            },
            "scheme": "UsernamePassword"
        },
        "createdBy": null,
        "data": {
            "authorizationType": "Kubeconfig",
            "acceptUntrustedCerts": "false"
        },
        "name": "{endpoint name}",
        "type": "kubernetes",
        "url": "{url}",
        "readersGroup": null,
        "groupScopeId": null,
        "isReady": false,
        "operationStatus": null
    }
    

    Sample kubeconfig: cni-plugin/kubeconfig.sample

    0 讨论(0)
提交回复
热议问题