API Key format for Azure DevOps discovery

GtrPlyr80
Mega Contributor

I am unable to get the Config Management Discovery to work in the Cloud Admin Portal for the Azure DevOps config provider.   It fails every time.  The API Key format may be the problem, but the instructions here are vague:  https://www.servicenow.com/docs/r/it-operations-management/cloud-services-catalog/running-discovery-...

 

Does anyone have a screen shot that shows the correct values for the API Key Header, API Key Prefix, and Credential Alias fields?   Should they be empty or filled in?

 

I have a valid PAT that works with the Azure DevOps REST API without any problems.   

I added the 'deploymentID' to the pipelines that I want to be discovered.

The discovery with my Terraform config provider works as expected. 

1 ACCEPTED SOLUTION

Nishant_Shelar
Mega Guru

I ran into the same issue earlier, and the confusion is mainly around how Azure DevOps handles the PAT.

It doesn’t really behave like a standard API key. It actually expects Basic Auth. So instead of using an API Key credential, try switching to a Basic Auth credential.

What worked for me:

  • Username → anything (I just used AzureDevOps)
  • Password → your PAT

ServiceNow takes care of the encoding part (Basic base64(username:PAT)), so you don’t have to manually worry about headers or prefixes.


If you still go with API Key (I tried that initially), then:

  • API Key Header → Authorization
  • API Key Prefix → Basic
  • API Key Value → base64(:PAT)
  • Credential Alias → needs to be filled and correctly mapped

But honestly, that approach was a bit tricky and kept failing for me until I switched to Basic Auth.


Since your PAT is already working and Terraform discovery is fine, I’d say the issue is most likely with the credential setup or alias mapping rather than the PAT itself.

Switching to Basic Auth fixed it in my case 

 
 

View solution in original post

2 REPLIES 2

Nishant_Shelar
Mega Guru

I ran into the same issue earlier, and the confusion is mainly around how Azure DevOps handles the PAT.

It doesn’t really behave like a standard API key. It actually expects Basic Auth. So instead of using an API Key credential, try switching to a Basic Auth credential.

What worked for me:

  • Username → anything (I just used AzureDevOps)
  • Password → your PAT

ServiceNow takes care of the encoding part (Basic base64(username:PAT)), so you don’t have to manually worry about headers or prefixes.


If you still go with API Key (I tried that initially), then:

  • API Key Header → Authorization
  • API Key Prefix → Basic
  • API Key Value → base64(:PAT)
  • Credential Alias → needs to be filled and correctly mapped

But honestly, that approach was a bit tricky and kept failing for me until I switched to Basic Auth.


Since your PAT is already working and Terraform discovery is fine, I’d say the issue is most likely with the credential setup or alias mapping rather than the PAT itself.

Switching to Basic Auth fixed it in my case 

 
 

Thank you Nishant!   I got the API key working by following your instructions.   Thanks for being very specific about the values for each field.

 

I could not get the Cloud Config management to recognize the Basic Auth creds.   But it doesn't matter now since the API Key is working.