SonraQube has become grate tool providing detail analysis of code quality. Tracing of history of code quality checks let the development teams identify how the code quality improved (could be how the code is gotten so bad even). How to setup a SonarQube server to use with team foundation server is described in the post “Setting Up Sonar Server for TFS”. Let’s look at steps required to set this up in an Azure virtual machine and expose it to use with team services account.
- Setup an Azure virtual machine with Windows Server 2012 R2 Datacenter.
- Follow the instructions in the post “Setting Up Sonar Server for TFS” and get the SonarQube server running inside the virtual machine.
- To allow accessing the Sonar server default port 9000 through firewall of the virtual machine add an inbound firewall rule in the virtual machine allowing port 9000 for public and private access.
- Above step alone will not allow public access to Azure VM hosted sonar server. You need to allow accessibility in Azure nsg(network security group) for the port. To do this go to the virtual machine in Azure portal, select Network Interfaces and click on the network interface.
Rule should be setup as shown below. You can click on Advance to get below view (Advance button changes to basic in this view). In advance view you can provide source port range. Set it to *. Destination port should be 9000 (Sonar server port).
5. Next step is setting up a DNS name. You can do this by clicking on Public IP address of the machine.
In the public IP configuration provide a DNS name and save.
This will allow your SonarQube server to be accessed similar to http://yoursonarservername.eastus.cloudapp.azure.com:9000 . Depending on the region the virtual machine is setup the URL eastus.cloudapp.azure.com highlighted region should change.
You can setup a service endpoint in Team Services for sonar server for same URL and use the server to do code quality checks with TFS builds. The post “Setup SonarQube Analysis with TFS Builds” describes this default available Tasks in TFS. These tasks a re now deprecated and you can use new extension in marketplace and use the sonar server setup in Azure VM. Setting up of it is similar as described in “Setup SonarQube Analysis with TFS Builds”, except the service end point is not anymore generic. This extension adds special service endpoint type SonarQube to the endpoints in team services.
No comments:
Post a Comment