Azure devops VSTS API中的队列yaml内置提供无法解决引用错误

Azure devops VSTS API中的队列yaml内置提供无法解决引用错误,azure-devops,Azure Devops,我正在使用PowerShell在VSTS中对yaml构建定义排队,看起来我没有为VSTS API调用提供正确的JSON主体: $uri = "https://$($accountName).visualstudio.com/$($projectName)/_apis/build/builds?api-version=4.1" $body = @{ "definition" = @{ "id" = "$($buildDefinitionId)" "sou

我正在使用PowerShell在VSTS中对yaml构建定义排队,看起来我没有为VSTS API调用提供正确的JSON主体:

$uri = "https://$($accountName).visualstudio.com/$($projectName)/_apis/build/builds?api-version=4.1" 

$body = @{
    "definition" = @{
        "id" = "$($buildDefinitionId)"
        "sourceBranch" = "refs/heads/master"
    }
}
以下是错误消息:

"error","message":"Unable to resolve the 
reference '' to a specific version. Verify the reference exists in the source repository.

我可以确认项目中存在YAML构建定义。我看了一个GitHub的问题,这个问题也提交了类似的文件,但似乎没有什么帮助。有什么想法吗?

改用以下代码:

$body = @{
    "definition" = @{
        "id" = "$($buildDefinitionId)"; 
    };
    "sourceBranch" = "refs/heads/master";
}

哇,这就像将sourceBranch属性移出一样简单。看起来很有效,谢谢!