Search code examples
azure-devopsazure-devops-rest-api

Change Azure DevOps Organization setting through REST API


I've been going through the Azure DevOps API docs, but I can't seem to find an endpoint for changing organization settings through the REST API.

More specifically, I'm trying to change the Pipeline settings. For a project, this exists, but it seems at Organization level it is not possible.

enter image description here

Am I right this is not feasible through the REST API? Would this be possible via the Azure DevOps CLI?


Solution

  • After my investigation, there is no DevOps Rest API in the official document as you said. As a suggestion, you could submit a suggestion ticket to suggest the feature on: https://developercommunity.visualstudio.com/report?space=21&entry=suggestion.

    However, we can use this API in F12 to change the organization pipeline general settings as a workaround.

    POST https://dev.azure.com/{org}/_apis/Contribution/HierarchyQuery?api-version=5.0-preview.1
    content-type: application/json
    request body:
    {
      "contributionIds": [
        "ms.vss-build-web.pipelines-org-settings-data-provider"
      ],
      "dataProviderContext": {
        "properties": {
          "badgesArePublic": "true",
          "sourcePage": {
            "url": "https://dev.azure.com/{org_name}/_settings/pipelinessettings",
            "routeId": "ms.vss-admin-web.collection-admin-hub-route",
            "routeValues": {
              "adminPivot": "pipelinessettings",
              "controller": "ContributedPage",
              "action": "Execute",
              "serviceHost": "{please check it in F12 when changing settings}"
            }
          }
        }
      }
    }
    

    Names of these settings:

    badgesArePublic: Disable anonymous access to badges

    enforceSettableVar: Limit variables that can be set at queue time

    enforceJobAuthScope: Limit job authorization scope to current project for non-release pipelines

    enforceJobAuthScopeForReleases: Limit job authorization scope to current project for release pipelines

    enforceReferencedRepoScopedToken: Protect access to repositories in YAML pipelines

    disableStageChooser: Disable stage chooser