Skip to main content

Send-MtTeamsMessage

SYNOPSIS

Send an adaptive card in a teams channel with the summary of the Maester test results

SYNTAX

MSGraph

Send-MtTeamsMessage [-MaesterResults] <PSObject> [-TeamId] <String> [-TeamChannelId] <String>
[-Subject <String>] [-TestResultsUri <String>] [-ProgressAction <ActionPreference>] [<CommonParameters>]

Webhook

Send-MtTeamsMessage [-MaesterResults] <PSObject> [-TeamChannelWebhookUri] <String> [-Subject <String>]
[-TestResultsUri <String>] [-ProgressAction <ActionPreference>] [<CommonParameters>]

DESCRIPTION

Uses Graph API to send an adaptive card in a teams channel with the summary of the Maester test results.

This command requires the ChannelMessage.Send delegate permission in the Microsoft Graph API.

Note: Teamwork.Migrate.All application permission is required if running in a non-interactive environment (Azure DevOps, GitHub) to send messages to a channel.

When running interactively this can be done by running the following command:

Connect-MtGraph -SendTeamsMessage

When running in a non-interactive environment (Azure DevOps, GitHub) the ChannelMessage.Send permission must be granted to the application in the Microsoft Entra portal.

EXAMPLES

EXAMPLE 1

Send-MtTeamsMessage -MaesterResults $MaesterResults -TeamId '00000000-0000-0000-0000-000000000000' -TeamChannelId '19%3A00000000000000000000000000000000%40thread.tacv2' -Subject 'Maester Results' -TestResultsUri "https://github.com/contoso/maester/runs/123456789"

Sends an Adaptive Card in a Teams Channel with the summary of the Maester test results to the specified channel along with the link to the detailed test results.

EXAMPLE 2

Send-MtTeamsMessage -MaesterResults $MaesterResults -TeamChannelWebhookUri 'https://some-url.logic.azure.com/workflows/invoke?api-version=2016-06-01' -Subject 'Maester Results' -TestResultsUri "https://github.com/contoso/maester/runs/123456789"

Sends an Adaptive Card in a Teams Channel with the summary of the Maester test results to the specified channel along with the link to the detailed test results.

PARAMETERS

-MaesterResults

The Maester test results returned from Invoke-Pester -PassThru | ConvertTo-MtMaesterResult

Type: PSObject
Parameter Sets: (All)
Aliases:

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

-TeamId

The Teams team where the test results should be posted. To get the TeamId, right-click on the channel in Teams and select 'Get link to channel'. Use the value of groupId. e.g. ?groupId=<TeamId>

Type: String
Parameter Sets: MSGraph
Aliases:

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

-TeamChannelId

The channel where the message should be posted. e.g. 19%3A00000000000000000000000000000000%40thread.tacv2 To get the TeamChannelId, right-click on the channel in Teams and select 'Get link to channel'. Use the value found between channel and the channel name. e.g. /channel/<TeamChannelId>/my%20channel

Type: String
Parameter Sets: MSGraph
Aliases:

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

-TeamChannelWebhookUri

The URL of the webhook where the message should be posted. e.g. 'https://some-url.logic.azure.com/workflows/invoke?api-version=2016-06-01' To get the webhook Url, right-click on the channel in Teams and select 'Workflow'. Create a workflow using the 'Post to a channel when a webhook request is received' template. Use the value after complete

Type: String
Parameter Sets: Webhook
Aliases:

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

-Subject

The subject of the card. Defaults to 'Maester Test Results'.

Type: String
Parameter Sets: (All)
Aliases:

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

-TestResultsUri

Uri to the detailed test results page.

Type: String
Parameter Sets: (All)
Aliases:

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

-ProgressAction

{{ Fill ProgressAction Description }}

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
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

https://maester.dev/docs/commands/Send-MtTeamsMessage