Description
Environment
azure-pipelines-task-lib version: 4.10.1
Issue Description
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 have found a similar issue #579 but for the typescript language.
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 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 existing 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.