Skip to content

AzDoGroupMember

Michael Zanatta edited this page Aug 19, 2026 · 4 revisions

DSC AzDoGroupMember Resource

Syntax

AzDoGroupMember [string] #ResourceName
{
    GroupName = [String]$GroupName # [ProjectName|OrganizationName]\GroupName
    # For GroupMember Syntax, refer to # GroupMembers Syntax
    [ GroupMembers = [String[]]$GroupMembers ]
    [ Ensure = [String] {'Present', 'Absent'} ]
}

GroupMembers Syntax

{
    GroupMember = [String]$GroupMemberName # [ProjectName|OrganizationName]\GroupName
}

The following string represents the service accounts for the project collection in Azure DevOps Organization:

[ProjectName|AZDOOrganizationName]\Project Collection Service Accounts
  • [ProjectName|AZDOOrganizationName]: The AzDO Project or Organizational Name.
  • Project Collection Service Accounts: The Group Member Name. This can be a Group Name, Service Principal Name or Service Principle.

Example

If your Azure DevOps Organization name is MyOrg, the string would look like:

[MyOrg]\Project Collection Service Accounts

Properties

Common Properties:

  • GroupName: The name of the Azure DevOps group.
  • GroupMembers: An array of members to be included in the Azure DevOps group.
  • Ensure: Specifies whether the group membership should be applied. Defaults to 'Present'.

Additional Information

This resource is used to manage Azure DevOps group memberships using Desired State Configuration (DSC). It allows you to define the properties of an Azure DevOps group and ensures that the group is configured according to those properties.

Examples

Example 1: Sample Configuration for Azure DevOps Group using AzDoGroupMember Resource

Configuration ExampleConfig {
    Import-DscResource -ModuleName 'AzDevOpsDsc'

    Node localhost {
        AzDoGroupMember GroupExample {
            GroupName    = 'MySampleGroup'
            GroupMembers = @('user1@example.com', 'user2@example.com')
        }
    }
}

ExampleConfig
Start-DscConfiguration -Path ./ExampleConfig -Wait -Verbose

Example 2: Sample Configuration for Azure DevOps Group using Invoke-DSCResource

# Return the current configuration for AzDoGroupMember
$properties = @{
    GroupName    = 'MySampleGroup'
    GroupMembers = @('user1@example.com', 'user2@example.com')
}

Invoke-DSCResource -Name 'AzDoGroupMember' -Method Get -Property $properties -ModuleName 'AzureDevOpsDscNative'

Example 3: Sample Configuration to remove/exclude an Azure DevOps Group using Invoke-DSCResource

# Remove the Azure DevOps Group and ensure that it is not recreated.
$properties = @{
    GroupName    = 'MySampleGroup'
    Ensure       = 'Absent'
}

Invoke-DSCResource -Name 'AzDoGroupMember' -Method Set -Property $properties -ModuleName 'AzureDevOpsDscNative'

Example 4: Sample Configuration using Dsc.PipelineRunner

parameters: {}

variables: {
  GroupName: SampleGroup,
  GroupMembers: ['user1@example.com', 'user2@example.com']   
}

resources:

  - name: Group
    type: AzureDevOpsDscNative/AzDoGroupMember
    properties:
      groupName: $GroupName
      groupMembers: $GroupMembers

LCM Initialization

$params = @{
    AzureDevopsOrganizationName = "SampleAzDoOrgName"
    ConfigurationDirectory      = "C:\Datum\DSCOutput\"
    ConfigurationUrl            = 'https://configuration-path'
    JITToken                    = 'SampleJITToken'
    Mode                        = 'Set'
    AuthenticationType          = 'ManagedIdentity'
    ReportPath                  = 'C:\Datum\DSCOutput\Reports'
}

Invoke-DscPipelineRunner @params

Commands

Resources

Clone this wiki locally