Teams DevOps Notification
Post deployment/change notifications to the DevOps-Infos - PROD channel in the Entwicklung team.
Prerequisites: Azure CLI, PowerShell 7, Microsoft.Graph PowerShell SDK. See Setup below if not installed.
Connection
pwsh.exe -NoProfile -Command 'Set-MgGraphOption -DisableLoginByWAM $true; Connect-MgGraph -ClientId "6ecb0961-a7d0-41a3-a739-f5c8ea9f11f7" -TenantId "13d188a3-27b5-44c8-a858-a4c34d245819" -NoWelcome; <COMMANDS>'
If auth fails with "authentication needed", ask the user to re-consent in a browser window by running the command with -Scopes "Team.ReadBasic.All","Channel.ReadBasic.All","ChannelMessage.Send","ChannelMessage.Read.All".
Channel
- TeamId:
0f738422-fd52-47c3-a66e-6fb752433d2e - ChannelId:
19:437111994f9042af8d5a737b63d94e7c@thread.skype
Workflow
- Gather context: read the PR, git log, release pipeline info (use
az repos,az pipelines) - Read devops-deployment-notification.md for template, HTML format and tone
- Draft the message in markdown, show to user for approval
- Convert approved markdown to HTML for Teams
- Only send after explicit user confirmation
Message Template
Full template with field descriptions and HTML examples: devops-deployment-notification.md
**[Kategorie]**: [Komponente] — [Kurzbeschreibung]
[Komponente Version-Link] wurde auf [Umgebung] deployt.
Was wurde geaendert:
- Aenderung 1
- Aenderung 2
Rueckstiegsversion: [Version-Link]
- Komponente: the deployed service/application
- Kategorie: Fix, Bugfix, Feature, Config, Infrastructure
Sending Messages
$params = @{ Subject = "<SUBJECT>"; Body = @{ ContentType = "html"; Content = "<MESSAGE_HTML>" } }
New-MgTeamChannelMessage -TeamId "<TeamId>" -ChannelId "<ChannelId>" -BodyParameter $params
Use the first line of the template (**[Kategorie]**: [Komponente] — [Kurzbeschreibung]) as Subject (plain text, no markdown).
HTML Conventions
Teams messages use HTML. When converting the markdown draft:
**bold**→<strong>- Lists →
<ul><li>/<ol><li> - Links →
<a href="..."> - Line breaks →
<p>or<br> - Spacing →
<p> </p>between sections - Add
Message generated with Claude Codeat the end
Setup
Only needed if prerequisites are missing.
Azure CLI
PowerShell 7
Microsoft.Graph PowerShell SDK
Install-Module Microsoft.Graph -Scope CurrentUser -Repository PSGallery -Force
First-time auth
Run once to cache the token (opens a browser window):
pwsh.exe -NoProfile -Command 'Set-MgGraphOption -DisableLoginByWAM $true; Connect-MgGraph -ClientId "6ecb0961-a7d0-41a3-a739-f5c8ea9f11f7" -TenantId "13d188a3-27b5-44c8-a858-a4c34d245819" -Scopes "Team.ReadBasic.All","Channel.ReadBasic.All","ChannelMessage.Send","ChannelMessage.Read.All"'