# TFS Pull Request Decoration Not Working

**URL:** <https://community.sonarsource.com/t/tfs-pull-request-decoration-not-working/8713>\
**Category:** SonarQube Server / Community Build\
**Tags:** pull-request, sonarqube\
**Created:** [April 11, 2019, 11:28am UTC](https://community.sonarsource.com/t/tfs-pull-request-decoration-not-working/8713 "2019-04-11T11:28:32Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![JezR](https://avatars.discourse-cdn.com/v4/letter/j/45deac/32.png) [@JezR](https://community.sonarsource.com/u/JezR)\
**Post date:** [April 11, 2019, 11:28am UTC](https://community.sonarsource.com/t/tfs-pull-request-decoration-not-working/8713/1 "2019-04-11T11:28:33Z")

</div>

Hi,

We have recently deployed SonarQube 7.7 Developer and are having issues with the TFS Pull Request Decoration not working.

The following has been configured in SonarQube:

General Tab

- _sonar.core.serverBaseURL_ is set to the base url of SonarQube including the port number

Pull Request Tab

- _sonar.pullrequest.provider_ is set to VSTS/TFS
- _sonar.pullrequest.vsts.token.secured_ configured with a TFS User Token

The following has been configured in TFS:

- A User Token ( created by a BUILTIN Admin) and has been tested with **All Scopes** enabled and just the **Code (read and write)** enabled
- Build for project contains the **Prepare Analysis Configuration** and **Run Code Analysis** tasks and are using v4.\* of the task.
- A build policy has been setup on the master branch to use the gated build definition

When the build takes place the required keys in the **Run Code Analysis** log are shown to be populated (replaced some values below with X’s)

> 2019-04-10T12:25:09.3251334Z sonar.projectKey=XXXXXXXXXX  
> 2019-04-10T12:25:09.3251334Z sonar.projectName=XXXXXXXXXX  
> 2019-04-10T12:25:09.3251334Z sonar.projectVersion=1.0  
> 2019-04-10T12:25:09.3251334Z sonar.pullrequest.key=25370  
> 2019-04-10T12:25:09.3251334Z sonar.pullrequest.base=master  
> 2019-04-10T12:25:09.3251334Z sonar.pullrequest.branch=sonarqube\_test  
> 2019-04-10T12:25:09.3251334Z sonar.pullrequest.provider=vsts  
> 2019-04-10T12:25:09.3251334Z sonar.pullrequest.vsts.instanceUrl=[http://XXXXXXXXXX:8080/tfs/DefaultCollection/](http://XXXXXXXXXX:8080/tfs/DefaultCollection/)  
> 2019-04-10T12:25:09.3251334Z sonar.pullrequest.vsts.project=XXXXXXXXXX  
> 2019-04-10T12:25:09.3251334Z sonar.pullrequest.vsts.repository=XXXXXXXXXX

On the SonarQube server in the ce.log file it is reporting the following:

> 2019.04.09 11:37:57 WARN ce[AWoBrPsJBoXXTLlhWWsC][c.s.C.C.B.C] Failed to decorate VSTS Pull Request: API resource location 225f7195-f9c7-4d14-ab28-a83f7ff77e1f is not registered on [http://XXXXXXXXXX:8080/tfs/DefaultCollection/](http://XXXXXXXXXX:8080/tfs/DefaultCollection/). Failed to convert a response into an exception.  
> 2019.04.09 11:37:57 INFO ce[AWoBrPsJBoXXTLlhWWsC][o.s.c.t.CeWorkerImpl] Executed task | project=XXXXXXXXXX | type=REPORT | pullRequest=25391 | id=AWoBrPsJBoXXTLlhWWsC | submitter=admin | status=SUCCESS | time=1294ms  
> 2019.04.09 11:40:08 INFO ce[o.s.c.t.CeWorkerImpl] Execute task | project=XXXXXXXXXX | type=REPORT | id=AWoBrwIRBoXXTLlhWWsE | submitter=admin

Also from the SonarQube server within Internet Explorer I can access the TFS instance without any issues.

Is anyone able to advise what could be wrong or that I am missing?

---

<div class="post-metadata">

**Author:** ![BenjColombo](https://avatars.discourse-cdn.com/v4/letter/b/e99b99/32.png) [@BenjColombo](https://community.sonarsource.com/u/BenjColombo)\
**Post date:** [July 23, 2019, 9:13am UTC](https://community.sonarsource.com/t/tfs-pull-request-decoration-not-working/8713/2 "2019-07-23T09:13:49Z")

</div>

Hi,

I am facing a similar issue with SonarQube 7.9 with the same setup on TFS.  
Did you manage to fix the problem ?

Thank you.

---

<div class="post-metadata">

**Author:** ![JezR](https://avatars.discourse-cdn.com/v4/letter/j/45deac/32.png) [@JezR](https://community.sonarsource.com/u/JezR)\
**Post date:** [July 23, 2019, 4:21pm UTC](https://community.sonarsource.com/t/tfs-pull-request-decoration-not-working/8713/3 "2019-07-23T16:21:19Z")

</div>

Hi Benjamin,

We upgraded to TFS 2018.Update3.2 (16.131.28601.4) and this then worked.

---

<div class="post-metadata">

**Author:** ![BenjColombo](https://avatars.discourse-cdn.com/v4/letter/b/e99b99/32.png) [@BenjColombo](https://community.sonarsource.com/u/BenjColombo)\
**Post date:** [July 24, 2019, 7:52am UTC](https://community.sonarsource.com/t/tfs-pull-request-decoration-not-working/8713/4 "2019-07-24T07:52:15Z")

</div>

Hi Jez, and thank you for your response.

I forgot to mention I was using Azure DeOps Server instead of TFS 2017.

Anyway, I managed to discover the cause of my problem. It was due to my proxy firewall which blocked the request from the SonarQube server to TFS.

If anyone is facing similar issues, try to add your TFS server host name in “http.nonProxyHosts” in your “sonar.properties” file.

---

<div class="post-metadata">

**Author:** ![stringz](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/stringz/32/13059_2.png) [@stringz](https://community.sonarsource.com/u/stringz)\
**Post date:** [July 9, 2020, 5:06pm UTC](https://community.sonarsource.com/t/tfs-pull-request-decoration-not-working/8713/5 "2020-07-09T17:06:53Z")

</div>

Hi,

I have managed to run SonarQube Developer version in my local premises. I have Microsoft Team foundation server 2018 deployed on premises. How can decorate pull requests using SonarQube.

I have gone through settings in ALM Integration, but can’t find TFS there. Azure DevOps is that, Git hub is there, and GitLab is there, but I can’t find TFS.

Any place one could point me, or may be I am looking at the wrong direction…

SonarQube Version 8.3 Developer  
TFS version 2018.

Thanks.

---

<div class="post-metadata">

**Author:** ![mickaelcaro](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/mickaelcaro/32/4147_2.png) [@mickaelcaro](https://community.sonarsource.com/u/mickaelcaro)\
**Post date:** [July 10, 2020, 8:57am UTC](https://community.sonarsource.com/t/tfs-pull-request-decoration-not-working/8713/6 "2020-07-10T08:57:39Z")

</div>

Hi @stringz

Since Azure DevOps is the current name/version, it’s written like this everywhere in SonarQube. But you can use it to configure your TFS instance normally, it’s still supported.

HTH,  
Mickaël

---

<div class="post-metadata">

**Author:** ![stringz](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/stringz/32/13059_2.png) [@stringz](https://community.sonarsource.com/u/stringz)\
**Post date:** [July 29, 2020, 6:14pm UTC](https://community.sonarsource.com/t/tfs-pull-request-decoration-not-working/8713/7 "2020-07-29T18:14:53Z")

</div>

Hi Mickael,  
I have configured Sonarqube with my Builds from TFS, but the results are being displayed in Sonar Qube Server and in Sonar Qube Dashboard.

What I want is the results to be displayed in Pull Requests, so that during merge, those SONARQUBE results are displayed right in TFS.

Is that a possibility in Sonarqube and TFS ? If so, how do I implement it. I have been following the following documentation of SonarQube.

[https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-azure-devops/](https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-azure-devops/)  
[https://docs.sonarqube.org/latest/analysis/pr-decoration/](https://docs.sonarqube.org/latest/analysis/pr-decoration/)  
[https://docs.sonarqube.org/latest/analysis/pull-request/](https://docs.sonarqube.org/latest/analysis/pull-request/)

I am running Sonarqube 8.3 Developer edition with Oracle at backend and trying to DECORATE PULL REQUESTS in TFS. I don’t want the results sets in SonarQube. I have got in sonarqube, but I need them in TFS Pull Requests Section.

---

<div class="post-metadata">

**Author:** ![mickaelcaro](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/mickaelcaro/32/4147_2.png) [@mickaelcaro](https://community.sonarsource.com/u/mickaelcaro)\
**Post date:** [July 30, 2020, 5:26am UTC](https://community.sonarsource.com/t/tfs-pull-request-decoration-not-working/8713/8 "2020-07-30T05:26:17Z")

</div>

Hi @stringz

What you will have in your Pull Request for Azure DevOps are the issues posted as comment, on which you can change the status as well as having a link to point to the issue on SonarQube.

Which version of TFS are you using ?

Here are the main steps :

- Create a Personal Access Token on TFS with Code (Read & Write) permission
- Create an ALM configuration on SonarQube, with that token
- Configure your build pipeline to be triggered when a change is made on a Pull Request

And you should be good to go ! Let us know.

Mickaël

---

<div class="post-metadata">

**Author:** ![stringz](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/stringz/32/13059_2.png) [@stringz](https://community.sonarsource.com/u/stringz)\
**Post date:** [September 2, 2020, 4:44pm UTC](https://community.sonarsource.com/t/tfs-pull-request-decoration-not-working/8713/9 "2020-09-02T16:44:05Z")

</div>

Hi Mickaël,

Let me try to answer to you in detail.

TFS Version being used is Version 16.131.28601.4

- Create a Personal Access Token on TFS with Code (Read & Write) permission (DONE)
- Create an ALM configuration on SonarQube, with that token (DONE).
- Configure your build pipeline to be triggered when a change is made on a Pull Request (I think I have configured that, but do guide me if I might have missed it. Although I am quite sure, I have did it right.)

I am uploading some screen shots of my systems, for you to see the issue more clearly. Hope it helps for you to further guide me.

 ![Screenshot 2020-09-02 21.37.15](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/2X/9/9713aa89438472a9fd20c7383f19b3c5b6eb9731.png) ![Screenshot 2020-09-02 21.37.10](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/2X/2/2002d357aebd71453f224cc92e26846e1d90ca35.png) ![Screenshot 2020-09-02 21.36.40](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/2X/3/3e64bee68d2c496245c79982ca164e19bc253c5c.png) ![Screenshot 2020-09-02 21.35.56](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/2X/e/e155973d130fa54577fc812853689fb8ea0e5972.png)

---

<div class="post-metadata">

**Author:** ![mickaelcaro](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/mickaelcaro/32/4147_2.png) [@mickaelcaro](https://community.sonarsource.com/u/mickaelcaro)\
**Post date:** [September 3, 2020, 7:35am UTC](https://community.sonarsource.com/t/tfs-pull-request-decoration-not-working/8713/10 "2020-09-03T07:35:31Z")

</div>

Can you check the warnings that you have on the PR dashboard on SonarQube ? You seem to have 3 of them, if PR decoration is not working, it might help to troubleshoot.

---

<div class="post-metadata">

**Author:** ![stringz](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/stringz/32/13059_2.png) [@stringz](https://community.sonarsource.com/u/stringz)\
**Post date:** [September 14, 2020, 7:29pm UTC](https://community.sonarsource.com/t/tfs-pull-request-decoration-not-working/8713/11 "2020-09-14T19:29:56Z")

</div>

Hi,

I have now 2 warning. Providing you the snapshot, and there is no indication of what I need to do.

Also, I have managed to run the Pull Request SCAN from sonar from TFS. The builds are running from TFS and Pull Requests are being pulled, but there is no errors.

I even made a buggy PR, having a security bug of Cross Site scripting, but that bug of PR didn’t catch any errors in SonarCube and it has Passed status. Please find the snapshots.

 ![Screenshot 2020-09-14 15.59.41](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/2X/b/bf530cdd9e43a1352a6ff162d816512a07faa973.png)  
 ![Screenshot 2020-09-15 00.25.40](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/2X/a/afb5db44bda3c672108c622fcdef16df7c9b8730.png)  
 ![Screenshot 2020-09-15 00.26.54](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/2X/f/f04558299aabe7ff890f471415ff5ea33c3900e0.png)

Screen shot of TFS code, having Cross Site vulnerability.

 ![Screenshot 2020-09-15 00.28.43](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/2X/3/303553447a69d3547516bf3fc2c5ebcbd61053bb.png)

 ![Screenshot 2020-09-15 00.29.55](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/2X/a/a5900dafbff4acef4eef3f4e38ff1d4325b62312.png)

---

<div class="post-metadata">

**Author:** ![mickaelcaro](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/mickaelcaro/32/4147_2.png) [@mickaelcaro](https://community.sonarsource.com/u/mickaelcaro)\
**Post date:** [September 15, 2020, 5:44am UTC](https://community.sonarsource.com/t/tfs-pull-request-decoration-not-working/8713/12 "2020-09-15T05:44:43Z")

</div>

Can you please go to the administration of your project, then background tasks, then click on the wheel (very right of the row) on a line referring to a PR analysis, and click on show sonarscanner context, then copy/paste (i will send you a PM for that) the result to that PM thread ?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![stringz](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/stringz/32/13059_2.png) [@stringz](https://community.sonarsource.com/u/stringz)\
**Post date:** [September 16, 2020, 8:34am UTC](https://community.sonarsource.com/t/tfs-pull-request-decoration-not-working/8713/13 "2020-09-16T08:34:29Z")

</div>

Thanks Micheal for your support and detailed steps.

Sent the Back Ground TASKS details over @ PM.

---

<div class="post-metadata">

**Author:** ![stringz](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/stringz/32/13059_2.png) [@stringz](https://community.sonarsource.com/u/stringz)\
**Post date:** [October 8, 2020, 4:43pm UTC](https://community.sonarsource.com/t/tfs-pull-request-decoration-not-working/8713/14 "2020-10-08T16:43:41Z")

</div>

Hi Michealcaro,  
Any updates regarding my problem. ?

---

<div class="post-metadata">

**Author:** ![mickaelcaro](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/mickaelcaro/32/4147_2.png) [@mickaelcaro](https://community.sonarsource.com/u/mickaelcaro)\
**Post date:** [October 9, 2020, 6:29am UTC](https://community.sonarsource.com/t/tfs-pull-request-decoration-not-working/8713/15 "2020-10-09T06:29:50Z")

</div>

Hi,

Did you manage to get code smells at least, as suggested in my last PM reply ?

---

<div class="post-metadata">

**Author:** ![stringz](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/stringz/32/13059_2.png) [@stringz](https://community.sonarsource.com/u/stringz)\
**Post date:** [October 13, 2020, 7:45am UTC](https://community.sonarsource.com/t/tfs-pull-request-decoration-not-working/8713/16 "2020-10-13T07:45:17Z")

</div>

No. The PRs which are analysed, are without any decorations, w.r.t security / code smells. They say, everything is OK.
