Unable to run CLI - the Postman server returned status code: 401

In Azure DevOps, We started getting this error when running our tests in the CLI Pipeline.
I have changed the api-key and set it to never expire.

I am still getting a 401. Nothing has changed outside of the collection

Make sure the variable that stores your API key is actually being passed into the Postman CLI step. It’s pretty common for a renamed variable to get skipped after updating a secret.

Also check that the collection and environment running in the pipeline are the same ones you tested locally. If you’re using Postman CLI, try printing or logging the variable in a pre-request script (just don’t show the full value) to confirm it’s being read correctly.

ok it I found the problem. it’s the way I’m trying to pull the global collection and it looks like this method doesn’t work anymore.

postman collection run “[collectionUUID]” -e “[environmentUUID]” -g “https://api.getpostman.com/workspaces/[workspaceUUID]/global-variables?apikey=$(POSTMAN_API_KEY)” --ignore-redirects --delay-request 1000

Do you have any suggestions on how to get the global-variables?

Try adding a script step before running Postman CLI.

Try

(Download globals to a file)

curl -s -H “X-Api-Key: $POSTMAN_API_KEY”
https://api.getpostman.com/workspaces//global-variables
-o globals.json

(Pass the file to Postman CLI)

postman collection run “”
-e “”
-g “globals.json”

Hey @johnDT

Could you try using the global-variables endpoint again with the Postman CLI to see if that’s working again?

We reverted a change on our side and I wanted to check. :folded_hands: