Zum Hauptinhalt springen

Teams DevOps Notification

🤖 Generated with Claude Code

⚠️ Not yet reviewed

Co-Authored-By: Claude (noreply@anthropic.com)

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 (MUST — follow in order)​

  1. Gather context: read the PR, git log, release pipeline info (use az repos, az pipelines)
  2. Read devops-deployment-notification.md for template, HTML format and tone
  3. Draft the message in markdown and show it to the user for approval
  4. Convert the approved markdown to HTML for Teams
  5. A message MUST NOT be sent without 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 geändert:
- Änderung 1
- Änderung 2

Rückstiegsversion: [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

The first line of the template (**[Kategorie]**: [Komponente] — [Kurzbeschreibung]) MUST be used as the Subject, as plain text without markdown.

HTML Conventions (MUST)​

Teams messages use HTML. When converting the markdown draft, the following mappings MUST be applied:

  • **bold** → <strong>
  • Lists → <ul><li> / <ol><li>
  • Links → <a href="...">
  • Line breaks → <p> or <br>
  • Spacing → <p>&nbsp;</p> between sections

Every message MUST end with Message generated with Claude Code.

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"'