skip to Main Content

so for updating azure pipeline permission for resource, I already found that we can achieve that through using api calls like https://learn.microsoft.com/en-us/rest/api/azure/devops/approvalsandchecks/pipeline-permissions/update-pipeline-permisions-for-resource?view=azure-devops-rest-7.1&tabs=HTTP

the question will be can we use cli to achieve the same outcome?

for cli permission manage I only found https://learn.microsoft.com/en-us/azure/devops/organizations/security/manage-tokens-namespaces?view=azure-devops#update-permissions
but it only does something like You can assign allow or deny permissions to a specified user or group, not exactly what I am looking for

so wondering if there are ways to use cli only to achieve the patch operation above

big thanks

2

Answers


  1. The Azure DevOps REST API "Pipeline Permissions – Update Pipeline Permisions For Resource" is used to update the pipeline permissions on using the following resource: agent pool, environment, agent queue, repository, secure files, service connection, and variable group.

    Currently, there is no corresponding Azure DevOps CLI can do the same things. There is also no separate CLI for each resource to update the pipeline permissions on the resource.

    If your projects really need this feature, I recommend you try to report a feature request on Developer Community. That will make it more convenient for the product teams to receive and understand your ideas. And your feedback also could be helpful for improving the Azure DevOps products.

    Login or Signup to reply.
  2. There is not specific option for this in Azure CLI. But it that case you can always use az devops invoke

    [Here] is a quite good blog post about this but in general your call should be something like this

    # Write the JSON body to disk
    'Json content' | Out-File -FilePath .body.json
     
    # PATCH the build with a cancelling status
    az devops invoke `
         --area pipelinePermissions `
         --resource pipelinePermissions `
         --organization https://dev.azure.com/myorgname `
         --route-parameters `
              project="MyProject" `
              resource="ResourceName" `
              resourceType="someType"  `
              resourceId="SomeId" `
         --in-file .body.json `
         --http-method patch
    

    based on this entry

      {
        "area": "pipelinePermissions",
        "id": "b5b9a4a4-e6cd-4096-853c-ab7d8b0c4eb2",
        "maxVersion": 7.2,
        "minVersion": 5.1,
        "releasedVersion": "0.0",
        "resourceName": "pipelinePermissions",
        "resourceVersion": 1,
        "routeTemplate": "{project}/_apis/pipelines/{resource}/{resourceType}/{resourceId}"
      },
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search