MicrosoftDocs / vsts-rest-api-specs

MIT License
158 stars 114 forks source link

Service Endpoint REST API The String length exceeds maximum limit #705

Closed MarcoipPolo closed 2 days ago

MarcoipPolo commented 3 days ago

I am trying to use the REST API to generate service connections to an Azure kubernetes cluster using this culr command:

curl --request POST `
  --url https://dev.azure.com/{project_name}/_apis/serviceendpoint/endpoints?api-version=7.2-preview.4 `
  --user {user_name}:{password}`
  --header 'Content-Type: application/json' `
  --data $scData

$scData = "{
  `"data`": {
    `"authorizationType`": `"ServiceAccount`",
    `"acceptUntrustedCerts`": true
  },
  `"name`": `"$($json.name)`",
  `"type`": `"kubernetes`",
  `"url`": `"$clusterUrl`",
  `"authorization`": {
    `"scheme`": `"Token`",
    `"parameters`": {
      `"apiToken`": `"$token`",
      `"serviceAccountCertificate`": `"$certificate`",
      `"isCreatedFromSecretYaml`": false
    }
  },
  `"serviceEndpointProjectReferences`": [
    {
      `"name`": `"$($json.name)`",
      `"projectReference`": {
        `"id`": `"$($json.devops.projectId)`",
        `"name`": `"`"
      }
    }
  ]
}"

However i am getting this error message:

{
  "$id": "1",
  "innerException": null,
  "message": "The String length exceeds maximum limit.\r\nParameter name: endpoint.Authorization.Parameters[apitoken]",
  "typeName": "System.ArgumentException, mscorlib",
  "typeKey": "ArgumentException",
  "errorCode": 0,
  "eventId": 0
}

Questions?


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.