# Unable to connect Azure Devops - Invalid Azure URL or Personal Access Token

**URL:** <https://community.sonarsource.com/t/unable-to-connect-azure-devops-invalid-azure-url-or-personal-access-token/89484>\
**Category:** SonarQube Server / Community Build\
**Tags:** azuredevops-services, sonarqube\
**Created:** [April 19, 2023, 10:37am UTC](https://community.sonarsource.com/t/unable-to-connect-azure-devops-invalid-azure-url-or-personal-access-token/89484 "2023-04-19T10:37:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![srih179](https://avatars.discourse-cdn.com/v4/letter/s/b9e5f3/32.png) [@srih179](https://community.sonarsource.com/u/srih179)\
**Post date:** [April 19, 2023, 10:37am UTC](https://community.sonarsource.com/t/unable-to-connect-azure-devops-invalid-azure-url-or-personal-access-token/89484/1 "2023-04-19T10:37:17Z")

</div>

- which versions are you using (SonarQube 9.9 LTS Enterprise, Scanner 4.8, Plugin 5.13)
- how is SonarQube deployed: installed in Azure VMwith SQ Zip file
- what are you trying to achieve - configuring Azure devops in sonar portal
- what have you tried so far to achieve this - Provided requested details (Azure URL and PAT)

For configuring Azure Devops with proper link and PAT, sonarqube is throwing an error as ‘Invalid Azure URL or Personal Access Token’!!!

The debug log of web.log shows the below lines

[[o.s.a.c.a.AzureDevOpsHttpClient] check pat : [`https://dev.azure.com/xxxxxxx/_apis/p`

rojects?api-version=3.0]

[o.s.a.c.a.AzureDevOpsHttpClient] Unable to contact Azure DevOps server for request

`https://dev.azure.com/xxxxxxx/_apis/projects?api-version=3.0`: [Unexpected response code for CONNECT: 400

During Service Connection configuration in Azure devops, Sonarqube plugin shows as Basic Authentication after providing Sonarqube URL and Global Analysis token, is it forcing us to use Basic auth only ??

Regards,  
Sriharsha

---

<div class="post-metadata">

**Author:** ![ganncamp](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ganncamp/32/1261_2.png) [@ganncamp](https://community.sonarsource.com/u/ganncamp)\
**Post date:** [April 20, 2023, 3:36pm UTC](https://community.sonarsource.com/t/unable-to-connect-azure-devops-invalid-azure-url-or-personal-access-token/89484/2 "2023-04-20T15:36:10Z")

</div>

Hi Sriharsha,

I think this thread is relevant:

> [@Unable to contact Azure DevOps Server invalid PAT](https://community.sonarsource.com/t/unable-to-contact-azure-devops-server-invalid-pat/83903/19):
>
> Hi again, This is the exact request that SonarQube sends to retrieve the projects list. From what I can see from your response, the PAT is In fact working. Could you compare that your SQ is making this exact curl request? If this curl worked for you in this regard to get the list of projects, it should have also worked the same from your SQ instance because it is the same request. Regards

&nbsp;  
HTH,  
Ann

---

<div class="post-metadata">

**Author:** ![srih179](https://avatars.discourse-cdn.com/v4/letter/s/b9e5f3/32.png) [@srih179](https://community.sonarsource.com/u/srih179)\
**Post date:** [April 25, 2023, 8:28am UTC](https://community.sonarsource.com/t/unable-to-connect-azure-devops-invalid-azure-url-or-personal-access-token/89484/3 "2023-04-25T08:28:45Z")

</div>

Hi Ann,

Thank you for the reply.

We are using Azure DevOps service

if we curl the URL  
root@:~# curl -X GET “http://${URL}/\_apis/projects?api-version=3.0” -u “:${PAT}”

getting authentication errors as

```auto
<html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href="https://spsprodcus3.vssps.visualstudio.com/_signin?realm=dev.azure.com&amp;reply_to=htxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx..............

```

We are using SAML for the Sonarqube portal login without any issues but why for DevOps it stops Authentication on the Microsoft login page?

Is there any setting in Sonarqube to disable Basic Authentication?

Regards,  
Sriharsha.

---

<div class="post-metadata">

**Author:** ![srih179](https://avatars.discourse-cdn.com/v4/letter/s/b9e5f3/32.png) [@srih179](https://community.sonarsource.com/u/srih179)\
**Post date:** [April 27, 2023, 9:02am UTC](https://community.sonarsource.com/t/unable-to-connect-azure-devops-invalid-azure-url-or-personal-access-token/89484/4 "2023-04-27T09:02:52Z")

</div>

After providing azure VM private IP address in sonar.properties web address, It worked !

Thanks

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/system/32/31083_2.png) [@system](https://community.sonarsource.com/u/system)\
**Post date:** [May 4, 2023, 9:03am UTC](https://community.sonarsource.com/t/unable-to-connect-azure-devops-invalid-azure-url-or-personal-access-token/89484/5 "2023-05-04T09:03:16Z")

</div>

Closed on May 4, 2023, 9:03am UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
