Skip to main content

Add-VSTeamSonarQubeEndpoint

SYNOPSIS

Adds a new SonarQube service endpoint.

SYNTAX

Secure (Default)

Add-VSTeamSonarQubeEndpoint [-endpointName] <String> [-sonarqubeUrl] <String>
-securePersonalAccessToken <SecureString> -ProjectName <String> [<CommonParameters>]

Plain

Add-VSTeamSonarQubeEndpoint [-endpointName] <String> [-sonarqubeUrl] <String> [-personalAccessToken] <String>
-ProjectName <String> [<CommonParameters>]

DESCRIPTION

The cmdlet adds a new connection between TFS/AzD and a SonarQube server using the SonarQube connection type.

This is only used when using the SonarQube tasks.

Using SonarQube with the Maven tasks uses a Generic Connection type.

EXAMPLES

Example 1

Add-VSTeamSonarQubeEndpoint -SonarQubeUrl "https://sonarqube.example.com" -PersonalAccessToken "your_token_here" -EndpointName "SonarQube-Prod" -ProjectName "WebAppProject"

This command creates a new SonarQube service endpoint named "SonarQube-Prod" for the "WebAppProject" project. The SonarQube server's URL is "https://sonarqube.example.com", and authentication is done using the provided personal access token.

Example 2

$SecureToken = ConvertTo-SecureString "your_token_here" -AsPlainText -Force
Add-VSTeamSonarQubeEndpoint -SonarQubeUrl "https://sonarqube.example.com" -SecurePersonalAccessToken $SecureToken -EndpointName "SonarQube-Dev" -ProjectName "BackendServices"

In this example, a secure string is created first to hold the personal access token. The SonarQube service endpoint named "SonarQube-Dev" for the "BackendServices" project is then created using this secure string. The SonarQube server's URL is "https://sonarqube.example.com".

Example 3

Add-VSTeamSonarQubeEndpoint -SonarQubeUrl "https://sonar.example.org" -PersonalAccessToken "another_token_here" -EndpointName "SonarQube-Staging" -ProjectName "MobileAppProject"

This command sets up a SonarQube service endpoint named "SonarQube-Staging" for the "MobileAppProject". The SonarQube server's URL is "https://sonar.example.org", and it authenticates using the specified personal access token.

Example 4

$Token = ConvertTo-SecureString "unique_token_here" -AsPlainText -Force
Add-VSTeamSonarQubeEndpoint -SonarQubeUrl "https://sonarqube.example.net" -SecurePersonalAccessToken $Token -EndpointName "SonarQube-Test" -ProjectName "FrontendUI"

Here, a secure string is made initially to house the personal access token. The SonarQube service endpoint named "SonarQube-Test" for the "FrontendUI" project is subsequently created using this secure token. The URL for the SonarQube server is "https://sonarqube.example.net".

Example 5

Add-VSTeamSonarQubeEndpoint -SonarQubeUrl "https://sonarqube.example.co" -PersonalAccessToken "different_token_here" -EndpointName "SonarQube-Alpha" -ProjectName "DataAnalytics"

This command constructs a SonarQube service endpoint named "SonarQube-Alpha" for the project "DataAnalytics". The URL for the SonarQube server is "https://sonarqube.example.co", and authentication is achieved using the given personal access token.

PARAMETERS

-ProjectName

Specifies the team project for which this function operates.

You can tab complete from a list of available projects.

You can use Set-VSTeamDefaultProject to set a default project so you do not have to pass the ProjectName with each call.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-endpointName

The name displayed on the services page. In AzD this is the Connection Name.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 3
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-personalAccessToken

Authentication Token generated by SonarQube.

Type: String
Parameter Sets: Plain
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-securePersonalAccessToken

A secured string to capture your personal access token.

This will allow you to provide your personal access token without displaying it in plain text.

To use pat simply omit it from the Set-VSTeamAccount command.

Type: SecureString
Parameter Sets: Secure
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-sonarqubeUrl

URL of the sonarqube server.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

NOTES

Prerequisites:

Set the account and version that all calls will use with Set-VSTeamAccount. Default version sets to API version 3.0 (TFS2017) if not manually set.

tips:

  • check called version of the API with Get-VSTeamAPIVersion or Get-VSTeamInfo
  • use Set-VSTeamDefaultProject to set default project for every call
  • use Set-VSTeamDefaultAPITimeout to change the default timeout of 60 seconds for all calls.
  • use Profiles to load an account and the correct version

Get-VSTeamServiceEndpoint

Get-VSTeamServiceEndpointType

Remove-VSTeamServiceEndpoint