Skip to content

AzDoServiceConnection

github-actions[bot] edited this page Aug 19, 2026 · 4 revisions

Parameters

Parameter Attribute DataType Description Allowed Values
ProjectName Key System.String
ConnectionName Required System.String
ConnectionType Required System.String
AllowAllPipelines Write System.Boolean
Authorization Write System.Collections.Hashtable
Data Write System.Collections.Hashtable
Description Write System.String
Ensure Write Ensure Present, Absent
LookupResult Read System.Collections.Hashtable

Description

Examples

Example 1

This example shows how to create an Azure Resource Manager service connection in an Azure DevOps project.

Configuration Example
{
    Import-DscResource -ModuleName 'AzureDevOpsDscNative'

    node localhost
    {
        AzDoServiceConnection 'AddAzDoServiceConnection'
        {
            Ensure           = 'Present'
            ProjectName      = 'MyProject'
            ConnectionName   = 'MyAzureServiceConnection'
            ConnectionType   = 'AzureRM'
            Description      = 'Connection to Azure subscription'
            AllowAllPipelines = $true
            Authorization    = @{
                tenantId       = '00000000-0000-0000-0000-000000000000'
                servicePrincipalId = '00000000-0000-0000-0000-000000000001'
                authenticationType = 'spnKey'
            }
            Data             = @{
                subscriptionId   = '00000000-0000-0000-0000-000000000002'
                subscriptionName = 'My Azure Subscription'
            }
        }
    }
}

Example 2

This example shows how to update an existing service connection in an Azure DevOps project.

Configuration Example
{
    Import-DscResource -ModuleName 'AzureDevOpsDscNative'

    node localhost
    {
        AzDoServiceConnection 'UpdateAzDoServiceConnection'
        {
            Ensure           = 'Present'
            ProjectName      = 'MyProject'
            ConnectionName   = 'MyAzureServiceConnection'
            ConnectionType   = 'AzureRM'
            Description      = 'Connection to Azure subscription - updated'
            AllowAllPipelines = $false
            Authorization    = @{
                tenantId       = '00000000-0000-0000-0000-000000000000'
                servicePrincipalId = '00000000-0000-0000-0000-000000000001'
                authenticationType = 'spnKey'
            }
            Data             = @{
                subscriptionId   = '00000000-0000-0000-0000-000000000002'
                subscriptionName = 'My Azure Subscription'
            }
        }
    }
}

Example 3

This example shows how to remove a service connection from an Azure DevOps project.

Configuration Example
{
    Import-DscResource -ModuleName 'AzureDevOpsDscNative'

    node localhost
    {
        AzDoServiceConnection 'RemoveAzDoServiceConnection'
        {
            Ensure         = 'Absent'
            ProjectName    = 'MyProject'
            ConnectionName = 'MyAzureServiceConnection'
            ConnectionType = 'AzureRM'
        }
    }
}

Commands

Resources

Clone this wiki locally