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

337
Views
How to pass variables from Azure Pipeline to JavaScript?

I'm attempting to run an Azure Pipeline, with some environment variables defined in the pipeline itself, and I am using the Maven Build task to build my project with Maven to launch various tests. A JS file automatically runs before each test, and I'm supposed to configure these variables in this file, which would make them available to use in the tests themselves. Currently, I have something like this:

# azure-pipelines.yml

trigger:
- none

pool:
  vmImage: ubuntu-latest

variables:
- name: user_secret
  value: "foo"

steps:

 - task: Maven@3
   inputs:
     mavenPomFile: 'pom.xml'
     goals: test
     publishJUnitResults: true
     testResultsFiles: '**/surefire-reports/TEST-*.xml'
     javaHomeOption: 'JDKVersion'
     mavenVersionOption: 'Default'
     mavenAuthenticateFeed: false
     effectivePomSkip: false
     sonarQubeRunAnalysis: false
// config.js

function fn(){
    return  {
        secret: user_secret
    };
}

The error I get is "user_secret" is not defined

I am being told I can debug it locally because the pipeline is providing the values as environment variables, and that I should be able to validate that locally by setting the variables when I run my code. Unfortunately, I can't figure out how to do it.

Similar to the above example, I also tried to get the variable process.env.user_secret, but this didn't work for me either.

How can I access Azure variables in my code?

about 4 years ago · Juan Pablo Isaza
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!