title: How to update azure DevOps build definition source from azure repos to GitHub using rest api
body: <p>I am trying to change source from azure repos git to GitHub in azure DevOps build using rest api.</p>
  <p>This is the response I get for azure repos using azure Devops build definitions rest api - GET <a href="https://dev.azure.com/%7Borg_name%7D/%7Bproject_name%7D/_apis/build/definitions/%7BBuild_Id%7D?api-version=6.0" rel="nofollow noreferrer">https://dev.azure.com/{org_name}/{project_name}/_apis/build/definitions/{Build_Id}?api-version=6.0</a>?</p>
  <pre><code>&quot;repository&quot;: {
      &quot;properties&quot;: {
          &quot;cleanOptions&quot;: &quot;0&quot;,
          &quot;labelSources&quot;: &quot;0&quot;,
          &quot;labelSourcesFormat&quot;: &quot;$(build.buildNumber)&quot;,
          &quot;reportBuildStatus&quot;: &quot;true&quot;,
          &quot;gitLfsSupport&quot;: &quot;false&quot;,
          &quot;skipSyncSource&quot;: &quot;false&quot;,
          &quot;checkoutNestedSubmodules&quot;: &quot;false&quot;,
          &quot;fetchDepth&quot;: &quot;0&quot;
      },
      &quot;id&quot;: &quot;xxxx&quot;,
      &quot;type&quot;: &quot;TfsGit&quot;,
      &quot;name&quot;: &quot;{repo_name}&quot;,
      &quot;url&quot;: &quot;https://dev.azure.com/{org_name}/{project_name}/_git/{repo_name}&quot;,
      &quot;defaultBranch&quot;: &quot;refs/heads/master&quot;,
      &quot;clean&quot;: &quot;false&quot;,
      &quot;checkoutSubmodules&quot;: false
  },
  </code></pre>
  <p>If manually I change source from azure repos to GitHub this is the json response I get for GitHub repo -</p>
  <pre><code>  &quot;repository&quot;: {
      &quot;properties&quot;: {
          &quot;apiUrl&quot;: &quot;https://api.github.com/repos/{github_id}/{repo_name}&quot;,
          &quot;branchesUrl&quot;: &quot;https://api.github.com/repos/{github_id}/{repo_name}/branches&quot;,
          &quot;cloneUrl&quot;: &quot;https://github.com/{github_id}/{repo_name}.git&quot;,
          &quot;connectedServiceId&quot;: &quot;xxxxxxx&quot;,
          &quot;defaultBranch&quot;: &quot;master&quot;,
          &quot;fullName&quot;: &quot;{github_id}/{repo_name}&quot;,
          &quot;hasAdminPermissions&quot;: &quot;True&quot;,
          &quot;isFork&quot;: &quot;False&quot;,
          &quot;isPrivate&quot;: &quot;False&quot;,
          &quot;lastUpdated&quot;: &quot;10/16/2019 17:28:29&quot;,
          &quot;manageUrl&quot;: &quot;https://github.com/{github_id}/{repo_name}&quot;,
          &quot;nodeId&quot;: &quot;xxxxxx&quot;,
          &quot;ownerId&quot;: &quot;xxxxx&quot;,
          &quot;orgName&quot;: &quot;{github_id}&quot;,
          &quot;refsUrl&quot;: &quot;https://api.github.com/repos/{github_id}/pyapp/git/refs&quot;,
          &quot;safeRepository&quot;: &quot;{github_id}/pyapp&quot;,
          &quot;shortName&quot;: &quot;{repo_name}&quot;,
          &quot;ownerAvatarUrl&quot;: &quot;https://avatars2.githubusercontent.com/u/xxxxx?v=4&quot;,
          &quot;archived&quot;: &quot;False&quot;,
          &quot;externalId&quot;: &quot;xxxxxx&quot;,
          &quot;ownerIsAUser&quot;: &quot;True&quot;,
          &quot;checkoutNestedSubmodules&quot;: &quot;false&quot;,
          &quot;cleanOptions&quot;: &quot;0&quot;,
          &quot;fetchDepth&quot;: &quot;0&quot;,
          &quot;gitLfsSupport&quot;: &quot;false&quot;,
          &quot;reportBuildStatus&quot;: &quot;true&quot;,
          &quot;skipSyncSource&quot;: &quot;false&quot;,
          &quot;labelSourcesFormat&quot;: &quot;$(build.buildNumber)&quot;,
          &quot;labelSources&quot;: &quot;0&quot;
      },
   &quot;id&quot;: &quot;{github_id}/{repo_name}&quot;,
          &quot;type&quot;: &quot;GitHub&quot;,
          &quot;name&quot;: &quot;{github_id}/{repo_name}&quot;,
          &quot;url&quot;: &quot;https://github.com/{github_id}/{repo_name}.git&quot;,
          &quot;defaultBranch&quot;: &quot;master&quot;,
          &quot;clean&quot;: &quot;false&quot;,
         &quot;checkoutSubmodules&quot;: false
  </code></pre>
  <p>I tried to change azure repo to github using postman by copying GitHub json response body and adding in postman and tried to call put -https://dev.azure.com/{org_name}/{project_name}/_apis/build/definitions/{Build_Id}?api-version=6.0?</p>
  <p>But this does not work</p>
  <p>How can I achieve this using script or postman ? what am I missing here ?</p>
  <p><a href="https://i.stack.imgur.com/znffN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/znffN.png" alt="enter image description here" /></a></p>
  <p><a href="https://i.stack.imgur.com/nI4AQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nI4AQ.png" alt="enter image description here" /></a></p>