How to pass a Azure DevOps variable into a Postman value with Newman cli Companion?

Viewed 185

I have a Postman collection with environment and global variables. For security reasons I have my account credential in Azure DevOps Library as variable. With that credential I can recieve a token to use in my postman calls.

What I use now is the Newman cli Companion for Postman and my .yml gives no errors:

task: NewmanPostman@4
    displayName: Run API Tests
    inputs:
       collectionFileSource: 'test.postman_collection.json'
       environment: 'test.postman_environment.json'            
       globalVars: 'Password=$(AAD-Password)'

I have set AAD-Password with the correct value in the DevOps library, in the .yml I set the globalvars: 'Password=$(AAD-password)' and in the collection I use {{Password}} as value to give a key that value.

enter image description here

The problem is that when I use it like this my password variable doesn't seem to be set as I get a 'invalid token' return which means the password which I set for the token doesn't seem to be set. Does anyone now a different way to use a DevOps variable in a collection call or knows what I need to do different?

0 Answers
Related