You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wanted to authenticate using an Authentication HTTP header build manually using $env:SYSTEM_ACCESSTOKEN and using Invoke-RestMethod but it seems the access token is not available in the scope of the custom task.
How am I supposed to call the Azure DevOps server api from inside a powershell custom task?
I did not find an ewisting task doing the same using powershell.
There seems to exists a Vsts .NET Library wrapper, but I am not sure I can easily PATCH the package version to publish it to a field, and I can not find how I am supposed to import this library.
The text was updated successfully, but these errors were encountered:
I have found this issue microsoft/azure-pipelines-task-lib#579 in azure-pipeline-task-lib but for the typescript language. Feel free to move this issue to the other repo if more appropriate.
Task name
No response
Task version
No response
Environment type (Please select at least one enviroment where you face this issue)
Azure DevOps Server type
Azure DevOps Server (Please specify exact version in the textbox below)
Azure DevOps Server Version (if applicable)
2022.1
Operation system
Windows Server 2022
Question
Hi,
I want to create a custom powershell task to promote packages uploaded to Azure Artifacts automatically during the build pipeline.
I have successfully created a custom task, but I can't find a way to authenticate my request.
I build the url using the environment variables, which works:
$url = "$($env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI)_apis/packaging/feeds/$feedName/nuget/packages/" + $pkgName + "/versions/" + $pkgVersion + "?api-version=7.0"
I wanted to authenticate using an
Authentication
HTTP header build manually using$env:SYSTEM_ACCESSTOKEN
and usingInvoke-RestMethod
but it seems the access token is not available in the scope of the custom task.How am I supposed to call the Azure DevOps server api from inside a powershell custom task?
I did not find an ewisting task doing the same using powershell.
There seems to exists a Vsts .NET Library wrapper, but I am not sure I can easily PATCH the package version to publish it to a field, and I can not find how I am supposed to import this library.
The text was updated successfully, but these errors were encountered: