What is the proper way to authenticate within custom build task
See original GitHub issueI found the following issue by @gregpakes and had the exact same question which led to no answer other than it should be asked on this repo, so here it is.
Would it be possible to have a clear guide on how to get the access token to access Azure REST API?
- Hosted Microsoft Agent (macOS)
- Custom build task
I tried with the SystemVssConnection getEndpointAuthorizationParameter('SystemVssConnection', 'AccessToken', false); and it’s working but official documentation mention that we have to enable oauth on the job and get the token from System.AccessToken.
I am confused on which way to use in my custom task I am developing. vssconection would be much more straight forward as I would not have to mention to enable oauth access to use my task.
Thanks
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Authentication to access other parts of Azure DevOps within a ...
Specifically, I want to create a custom task that adds a comment to a PR. Unfortunately, I can't figure out how to authenticate...
Read more >Guidance for authentication - Azure DevOps - Microsoft Learn
A: The best practice is to have different authentication paths for Azure DevOps Server and Azure DevOps Services.
Read more >Trigger Build Task - Visual Studio Marketplace
First and foremost the authentication options (see below) are limited. You cannot use OAuth authentication, either use a Personal Access Token ...
Read more >Create HTTP tasks with authentication - Google Cloud
Creates tasks with OIDC token to send to a Cloud Run, Cloud Function, ... To learn how to install and use the client...
Read more >Create Custom Tokens | Firebase Authentication - Google
The main drawback of this approach is that it requires you to package a service account JSON file along with your code. Also...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’m not aware of any special treatment needed for YAML.
On Wed, 30 Oct 2019, 20:17 Eric Labelle, notifications@github.com wrote:
Hey @jessehouwing , one more question for you… I swapped from
System.AccessTokentoSystemVssConnectionand everything works well locally and in pipeline using Basic Editor but it fails when I try the task using the YAML pipeline.I know we had to add
env: SYSTEM_ACCESSTOKEN: $(System.AccessToken)with the predefined variable, but since SystemVssConnection is documented nowhere, I’m not sure what’s missing for YAML.There is mention on how to use a custom service connection here but I figured since this one is built-in I don’t have to specify this.
Thank you for your time!