en-US/about_AzDoWorkItemQuery.help.txt

.NAME
    AzDoWorkItemQuery
 
.SYNOPSIS
    DSC resource for managing Azure DevOps shared work item queries.
 
.DESCRIPTION
    Manages a saved query within a project's shared query tree, including its WIQL statement,
    display columns and sort order.
 
    The parent folder must already exist. Use AzDoQueryFolder with DependsOn to declare it.
 
.PARAMETER ProjectName
    Required - System.String
    The name of the Azure DevOps project.
 
.PARAMETER Path
    Key - System.String
    The full path of the query, including the root and any folders, for example
    'Shared Queries/Platform/Active Bugs'.
 
.PARAMETER Wiql
    Write - System.String
    The WIQL statement backing the query.
 
.PARAMETER QueryType
    Write - System.String
    Allowed values: flat, tree, oneHop
    'flat', 'tree' or 'oneHop'. Defaults to 'flat'.
 
.PARAMETER Columns
    Write - System.String[]
    Field reference names to display as columns, for example 'System.Id', 'System.Title'.
 
.PARAMETER SortColumns
    Write - HashTable[]
    Sort order, as an array of hashtables: @{ Field = 'System.Id'; Descending = $false }.
 
.EXAMPLE 1
 
This example shows how to create a shared work item query in an Azure DevOps project.
 
The query's parent folder must already exist - declare it with AzDoQueryFolder and use
DependsOn.
 
Configuration Example
{
    Import-DscResource -ModuleName 'AzureDevOpsDscNative'
 
    node localhost
    {
        AzDoQueryFolder 'AddPlatformFolder'
        {
            Ensure = 'Present'
            ProjectName = 'MyProject'
            Path = 'Shared Queries/Platform'
        }
 
        AzDoWorkItemQuery 'AddActiveBugsQuery'
        {
            Ensure = 'Present'
            ProjectName = 'MyProject'
            Path = 'Shared Queries/Platform/Active Bugs'
            Wiql = "SELECT [System.Id] FROM WorkItems WHERE [System.TeamProject] = @project AND [System.WorkItemType] = 'Bug' AND [System.State] = 'Active'"
            Columns = @('System.Id', 'System.Title', 'System.State', 'System.AssignedTo')
            DependsOn = '[AzDoQueryFolder]AddPlatformFolder'
        }
    }
}
 
.EXAMPLE 2
 
This example shows how to manage a query's WIQL, columns and sort order.
 
Changes are applied in place. The query keeps its id, so dashboard widgets, delivery
plans and ACL tokens that reference the query keep working across an update.
 
Configuration Example
{
    Import-DscResource -ModuleName 'AzureDevOpsDscNative'
 
    node localhost
    {
        AzDoWorkItemQuery 'UpdateActiveBugsQuery'
        {
            Ensure = 'Present'
            ProjectName = 'MyProject'
            Path = 'Shared Queries/Platform/Active Bugs'
            Wiql = "SELECT [System.Id] FROM WorkItems WHERE [System.TeamProject] = @project AND [System.WorkItemType] = 'Bug' AND [System.State] <> 'Closed'"
            QueryType = 'flat'
            Columns = @('System.Id', 'System.Title', 'System.State')
            SortColumns = @(
                @{ Field = 'System.ChangedDate'; Descending = $true }
            )
        }
    }
}
 
.EXAMPLE 3
 
This example shows how to remove a shared work item query.
 
Azure DevOps moves a deleted query to the project's query recycle bin rather than
destroying it outright.
 
Configuration Example
{
    Import-DscResource -ModuleName 'AzureDevOpsDscNative'
 
    node localhost
    {
        AzDoWorkItemQuery 'RemoveActiveBugsQuery'
        {
            Ensure = 'Absent'
            ProjectName = 'MyProject'
            Path = 'Shared Queries/Platform/Active Bugs'
        }
    }
}