azure-devops-rest-api

How to write a python script to authenticate to Azure DevOps REST API and get the access token?

纵饮孤独 提交于 2020-03-23 14:12:12
问题 How can I authenticate to Azure DevOps REST API in a python script? I found that there are 2 methods : Using personal access token (PAT) Using OAuth 2.0 I am using the second method. Followed the steps in this documentation: https://docs.microsoft.com/en-us/azure/devops/integrate/get-started/authentication/oauth?view=azure-devops I wrote this function to autherize to azure DevOps using OAuth 2.0: def get_authenticated(): client_id = < my client ID as a string > state = "user1" scope = "vso

VSTS Powershell Secret Variable

末鹿安然 提交于 2020-03-22 08:55:50
问题 How can I use a secret variable in my powershell script in my release definition? I came across this but it doesn't work. The directory "$($env:AGENT_HOMEDIRECTORY)\agent\worker\Modules" doesn't exist on the new agents. What's the correct way of accessing a secret variable on new hosts? My agent version is 2.114.0. 回答1: By design, you have to pass the value of secret variable through PowerShell parameters. For example: Variable: password (secret) task: PowerShell Arguments: -pass $(password)

VSTS Powershell Secret Variable

不羁的心 提交于 2020-03-22 08:55:22
问题 How can I use a secret variable in my powershell script in my release definition? I came across this but it doesn't work. The directory "$($env:AGENT_HOMEDIRECTORY)\agent\worker\Modules" doesn't exist on the new agents. What's the correct way of accessing a secret variable on new hosts? My agent version is 2.114.0. 回答1: By design, you have to pass the value of secret variable through PowerShell parameters. For example: Variable: password (secret) task: PowerShell Arguments: -pass $(password)

Update build definition using Azure DevOps REST API in PowerShell

点点圈 提交于 2020-03-21 06:45:08
问题 I'm attempting to update my build definitions in Azure DevOps using the REST API via a PowerShell script... $header = @{Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(":$($personalAccessToken)"))} $definitions = Invoke-RestMethod -Uri "https://devops.domain.com/Collection/Project/_apis/build/definitions" -Method GET -Header $header $branchNames = 'master', 'feature' ForEach ($definition in $definitions.value) { $definition | Add-Member -NotePropertyName

Azure DevOps REST API call retrieving only top 100 records

北城以北 提交于 2020-03-05 04:04:35
问题 I am using the below API call for retrieving all the CouldTests, but it is returning only 100 records. How can retrieve all the records?. $uri = https://{instance}/{collection}/{project}/_apis/test/runs?minLastUpdatedDate=2020-01-28&maxLastUpdatedDate=2020-01-29&releaseIds=123456&$top=2000 $TestRuns = Invoke-RestMethod -Uri $uri -Headers $headers Any help is appreciated. Thanks in advance For more about the above Link please refer.:https://docs.microsoft.com/en-us/rest/api/azure/devops/test

TFS rest api Invoke-restmethod “The underlying connection was closed: An unexpected error occurred on a receive”

大兔子大兔子 提交于 2020-03-03 11:55:34
问题 I am trying to invoke TFS and/or Azure DevOps REST Api in one of the powershell tasks in release pipeline in Azure DevOps. I tried running the same rest api code in two different servers (w/ azure pipeline agent installed) but one of them is working and one of them returns "The underlying connection was closed: An unexpected error occurred on a receive..". The two agent servers have both tls 1.1 and 1.2 enabled. the working server has powershell v 4.0 and the server that returns error has v5

Is there a way to get user permissions in a specific Azure Devops Project using rest api?

梦想的初衷 提交于 2020-02-22 08:00:30
问题 Hi I want to check the permissions of a user in a specific Azure Devops Project. Is there a possible way to get it? As far as I know project level permission is different than organization level permissions. Thanks. Already test some several rest apis but still I can't have the project level permission. 回答1: There is currently no out-of-the-box rest api to get the user's permission in project. To achieve this demand, you can use this rest api : https://dev.azure.com/{org}/_apis/Contribution

Is there a way to get user permissions in a specific Azure Devops Project using rest api?

耗尽温柔 提交于 2020-02-22 07:53:12
问题 Hi I want to check the permissions of a user in a specific Azure Devops Project. Is there a possible way to get it? As far as I know project level permission is different than organization level permissions. Thanks. Already test some several rest apis but still I can't have the project level permission. 回答1: There is currently no out-of-the-box rest api to get the user's permission in project. To achieve this demand, you can use this rest api : https://dev.azure.com/{org}/_apis/Contribution

How to use output variables across agent jobs in azure release pipeline

对着背影说爱祢 提交于 2020-02-02 11:57:13
问题 In my azure release pipeline I have 2 agent jobs, one is for sql deployment using power-shell and other is for kubernetes using power-shell. How to set an output variable in 1st agent job and use that in second agent job using power-shell. 回答1: How to use output variables across agent jobs in azure release pipeline I am afraid there is no way to use output variables across agent jobs directly for now. There is a related issue Variables set via logging commands are not persistent between

How to use output variables across agent jobs in azure release pipeline

故事扮演 提交于 2020-02-02 11:56:26
问题 In my azure release pipeline I have 2 agent jobs, one is for sql deployment using power-shell and other is for kubernetes using power-shell. How to set an output variable in 1st agent job and use that in second agent job using power-shell. 回答1: How to use output variables across agent jobs in azure release pipeline I am afraid there is no way to use output variables across agent jobs directly for now. There is a related issue Variables set via logging commands are not persistent between