I used this JSON to create my pipeline :
$pipelineJSON = @{
    configuration = @{
        variables = @{
            example = @{
                value = "to be defined"
            }
        }
        path = "azure-pipelines.yml"
        repository = @{
            id = "myRepoId"
            name = "myRepoName"
            type = "azureReposGit"
        }
        type = "yaml"
    }
    name = "pipeline-test"
    folder= "\\"
} | ConvertTo-Json
$request = 'https://dev.azure.com/' + $organization + '/' + $projectName + '/_apis/pipelines?api-version=6.0-preview.1'
$responseCreatePipeline = Invoke-RestMethod $request -Method 'POST' -Headers $headers -Body $pipelineJSON -ContentType "application/json"
 I want to create this pipeline from a YAML file located in a different branch. Does anyone know how to do it?