I am currently trying to run the 'npmAuthenticate' task within my Azure DevOps pipeline but seem to be running into an issue when the 'customEndpoint' is a set varaible. It appears to work just fine if I pass the same Service Connection Name in as a parameter but not when setting as a variable else where in the pipeline.
Broken:
jobs:
- job: Create_Files
displayName: Create Files
steps:
- task: Bash@3
displayName: Setting npm endpoint
inputs:
targetType: 'inline'
script: |
echo "##vso[task.setvariable variable=npm_endpoint]ExampleEndpointName"
- task: Bash@3
displayName: Debugging step to print variable
inputs:
targetType: 'inline'
script: |
echo "Printing npm endpoint - $(npm_endpoint)"
- task: npmAuthenticate@0
inputs:
workingFile: '${{ parameters.npmc_file }}'
customEndpoint: '$(npm_endpoint)'
When I try to run this I get the following error within Azure DevOps:
Encountered error(s) while parsing pipeline YAML: Job Create_Files: Step input customEndpoint references service connection $(npm_endpoint) which could not be found. The service connection does not exist or has not been authorized for use. For authorization details, refer to https://aka.ms/yamlauthz.
If I set the customEndpoint as a parameter being passed in with the exact same value it works fine.
jobs:
- job: Create_Files
displayName: Create Files
steps:
- task: npmAuthenticate@0
inputs:
workingFile: '${{ parameters.npmc_file }}'
customEndpoint: '${{ parameters.npm_endpoint }}'
Is there something I might be doing wrong here or has anybody seen anything like this?
EDIT Put in Debug step to print variable. When run it shows the correct value.
