Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

261
Views
Azure Devops Extension (VSTS) Set a variable that needs to be accessed in next task using Javascript

I am trying to access the variable set in one task from another task in JavaScript.

In the first task I am setting the variable as following:

var connection = tl.getInput("connection", true);
if(connection !== undefined) {
   var auth = tl.getEndpointAuthorization(connection, false);
      
   let access_key_1 = auth.parameters["password"];
   let username = auth.parameters["username"]; 
      
   if(auth !== undefined) {
       
   console.log('##vso[task.setvariable variable=access_key_1;]', access_key_1);
}

In the second task i am trying to access the variable:

console.log(access_key_1);

But I am getting error:

ReferenceError: access_key_1 is not defined.   
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The variable you created it's an environment variable, not JS variable.

So, to access it you should use process.env.access_key_1. if you to print:

console.log(process.env.access_key_1)
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!