Add-VSTeamServiceEndpoint
SYNOPSIS
Adds a generic service connection
SYNTAX
Add-VSTeamServiceEndpoint [-endpointName] <String> [-endpointType] <String> -object <Hashtable>
-ProjectName <String> [<CommonParameters>]
DESCRIPTION
The cmdlet adds a new generic connection between TFS/AzD and a third party service (see AzD for available connections).
EXAMPLES
Example 1
$payload = @{
url = "https://api.example.com";
username = "apiuser";
password = "apipassword";
}
Add-VSTeamServiceEndpoint -Object $payload -EndpointName "ExampleAPI" -EndpointType "generic" -ProjectName "WebAppProject"
This command creates a new generic service connection named "ExampleAPI" for the "WebAppProject" project. The service connection connects to "https://api.example.com" using the username "apiuser" and password "apipassword".
Example 2
$payload = @{
url = "https://k8s-cluster.example.org";
token = "k8s-access-token";
}
Add-VSTeamServiceEndpoint -Object $payload -EndpointName "K8sCluster" -EndpointType "kubernetes" -ProjectName "BackendServices"
In this example, a new Kubernetes service connection named "K8sCluster" for the "BackendServices" project is created. The service connection connects to the Kubernetes cluster at "https://k8s-cluster.example.org" using the provided token.
Example 3
$payload = @{
url = "https://sonarqube.example.net";
token = "sonar-access-token";
}
Add-VSTeamServiceEndpoint -Object $payload -EndpointName "SonarQubeDev" -EndpointType "sonarqube" -ProjectName "FrontendUI"
This command sets up a SonarQube service connection named "SonarQubeDev" for the "FrontendUI" project. The SonarQube server's URL is "https://sonarqube.example.net", and it authenticates using the specified token.
Example 4
$payload = @{
url = "https://db.example.co";
username = "dbadmin";
password = "dbpassword";
}
Add-VSTeamServiceEndpoint -Object $payload -EndpointName "DatabaseEndpoint" -EndpointType "generic" -ProjectName "DataServices"
Here, a generic service connection named "DatabaseEndpoint" for the "DataServices" project is created. The service connection connects to the database at "https://db.example.co" using the given username and password.
Example 5
$payload = @{
url = "https://storage.example.com";
accessKey = "storage-access-key";
}
Add-VSTeamServiceEndpoint -Object $payload -EndpointName "StorageService" -EndpointType "generic" -ProjectName "FileStorage"
This command constructs a generic service connection named "StorageService" for the project "FileStorage". The service connection links to the storage service at "https://storage.example.com" and uses the provided access key for authentication.
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: 2
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-endpointType
Type of endpoint (eg. `kubernetes`, `sonarqube`). See AzD service page for supported endpoints.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 3
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-object
Hashtable of Payload for REST call
Type: Hashtable
Parameter Sets: (All)
Aliases:
Required: True
Position: Named
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
vsteam_lib.ServiceEndpoint
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