Azure Devops YAML:无效的JavaScript属性标识符字符yaml

时间:2019-02-15 14:44:21

标签: azure-devops yaml

使用Azure DevOps YAML任务“ Invoke-HTTP”,我不断 Exception message 'Exception Message: Invalid JavaScript property identifier character: -. Path '', line 1, position 8. (type JsonReaderException)'

这是任务的文档:

https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/http-rest-api?view=azure-devops

脚本如下: jobs: # Publish resource group artifact - job: invoke_http_for_ase pool: server continueOnError: true steps: # Invoke REST API # Invoke a REST API as a part of your pipeline. - task: InvokeRESTAPI@1 displayName: 'GET Member' inputs: connectionType: 'connectedServiceNameARM' azureServiceConnection: 'ARM-Service-Connection' method: 'GET' headers: '{Content-Type:application/json}' urlSuffix: "subscriptions/xxx/resourceGroups/xxx?api-version=2018-05-01" waitForCompletion: 'true'

设计人员在发布管道中使用发布任务进行的相同工作。

1 个答案:

答案 0 :(得分:0)

缩进是您的问题。在“ jobs:”下方向左移动每行,即:

jobs: - job: invoke_http_for_ase pool: server continueOnError: true steps: # Invoke REST API # Invoke a REST API as a part of your pipeline. - task: InvokeRESTAPI@1 displayName: 'GET Member' inputs: connectionType: 'connectedServiceNameARM' azureServiceConnection: 'ARM-Service-Connection' method: 'GET' headers: '{Content-Type:application/json}' urlSuffix: "subscriptions/xxx/resourceGroups/xxx?api-version=2018-05-01" waitForCompletion: 'true'