Skip to main content

Add-VSTeamAzureRMServiceEndpoint

SYNOPSIS

Adds a new Azure Resource Manager service endpoint.

SYNTAX

Automatic (Default)

Add-VSTeamAzureRMServiceEndpoint [-SubscriptionName] <String> [-SubscriptionId] <String>
[-SubscriptionTenantId] <String> [[-EndpointName] <String>] [-Description <String>] -ProjectName <String>
[<CommonParameters>]

Manual

Add-VSTeamAzureRMServiceEndpoint [-SubscriptionName] <String> [-SubscriptionId] <String>
[-SubscriptionTenantId] <String> -ServicePrincipalId <String> -ServicePrincipalKey <String>
[[-EndpointName] <String>] [-Description <String>] -ProjectName <String> [<CommonParameters>]

DESCRIPTION

The cmdlet adds a new connection between TFS/AzD and Azure using the Azure Resource Manager connection type.

EXAMPLES

Example 1

Add-VSTeamAzureRMServiceEndpoint -SubscriptionName "MyAzureSubscription" -SubscriptionId "1234abcd-5678-efgh-9012-ijklmn345678" -SubscriptionTenantId "abcd1234-efgh-5678-ijkl-9012mn345678" -ServicePrincipalId "efgh1234-5678-abcd-9012-ijklmn345678" -ServicePrincipalKey "my-service-principal-key" -EndpointName "MyAzureEndpoint" -ProjectName "MyProject"

This command adds a new Azure Resource Manager service endpoint in the project named "MyProject" using the provided Azure subscription name, subscription ID, tenant ID, service principal ID, and service principal key. The service endpoint will be named "MyAzureEndpoint".

Example 2

$params = @{
SubscriptionName = "MyAzureSubscription";
SubscriptionId = "1234abcd-5678-efgh-9012-ijklmn345678";
SubscriptionTenantId = "abcd1234-efgh-5678-ijkl-9012mn345678";
ServicePrincipalId = "efgh1234-5678-abcd-9012-ijklmn345678";
ServicePrincipalKey = "my-service-principal-key";
EndpointName = "MyAzureEndpoint";
ProjectName = "MyProject";
}
Add-VSTeamAzureRMServiceEndpoint @params

This example does the same as the previous one but uses a hashtable to define the parameters for the `Add-VSTeamAzureRMServiceEndpoint` cmdlet.

Example 3

$endpoint = @{
SubscriptionName = "MyAzureSubscription";
SubscriptionId = "1234abcd-5678-efgh-9012-ijklmn345678";
SubscriptionTenantId = "abcd1234-efgh-5678-ijkl-9012mn345678";
ServicePrincipalId = "efgh1234-5678-abcd-9012-ijklmn345678";
ServicePrincipalKey = "my-service-principal-key";
}
Add-VSTeamAzureRMServiceEndpoint @endpoint -EndpointName "MyAzureEndpoint" -ProjectName "MyProject"

This example demonstrates how you can separate the Azure-related parameters and the Azure DevOps-related parameters. The Azure parameters are stored in the `$endpoint` hashtable, and the Azure DevOps parameters are provided directly to the cmdlet.

Remember that when working with Azure, Service Principals are a way to give applications permissions in Azure Active Directory. This allows those applications to manage resources in Azure. The Service Principal ID and Key are used to authenticate and authorize the application. Always handle the Service Principal Key with care as it is a sensitive piece of information.

PARAMETERS

-SubscriptionName

The name of the Azure Subscription.

Type: String
Parameter Sets: (All)
Aliases: displayName

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

-SubscriptionId

The id of the Azure subscription to use.

Type: String
Parameter Sets: (All)
Aliases:

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

-SubscriptionTenantId

The id of the Azure tenant to use.

Type: String
Parameter Sets: (All)
Aliases:

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

-ServicePrincipalId

The ID of the Azure Service Principal to use with this service endpoint.

Type: String
Parameter Sets: Manual
Aliases:

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

-ServicePrincipalKey

The key of the Azure Service Principal to use with this service endpoint.

Type: String
Parameter Sets: Manual
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: False
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Description

Description of the service endpoint.

Type: String
Parameter Sets: (All)
Aliases:

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

-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

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