Copy the script below, paste it into a PowerShell 7 window, and run it. It will prompt you to sign in with your admin account.
Full Month Script
Runs the correct redirect for whichever day it is today β ideal for a daily scheduled task.
Webhook URL
Paste your Azure Automation webhook URL here β the Sync button will POST to it automatically.
Runbook Code (On-Demand via Webhook)
1. SharePoint list IT-SUPPORT-ON-CALL-LIST on IT-Sharepoint is already created β
Columns used: Title (date), ShortName, ExternalNumber 2. In Settings (β), the SharePoint Site URL and list name are pre-filled β verify they match 3. Automation Account β Modules β Browse Gallery β import MicrosoftTeams (Runtime 7.2) 4. Enable System Assigned Managed Identity β assign Teams Administrator role in Entra ID
Also grant Sites.ReadWrite.All (Graph API) to the Managed Identity via PowerShell: $sp = Get-MgServicePrincipal -Filter "displayName eq 'YourAutomationAccountName'" $graph = Get-MgServicePrincipal -Filter "appId eq '00000003-0000-0000-c000-000000000000'" $role = $graph.AppRoles | Where { $_.Value -eq 'Sites.ReadWrite.All' } New-MgServicePrincipalAppRoleAssignment -ServicePrincipalId $sp.Id -PrincipalId $sp.Id -ResourceId $graph.Id -AppRoleId $role.Id 5.Runbooks β Create runbook (PowerShell 7.2) β paste code below β Publish 6. Runbook β Webhooks β Add webhook β copy URL β paste in field above
π Daily Auto-Sync at 00:00
No second runbook needed! The runbook above handles both manual and scheduled runs.
1. Automation Account β Schedules β Add a schedule
β’ Name: Daily-OnCall-Midnight
β’ Start: tomorrow at 00:00, timezone: Asia/Jerusalem
β’ Recurrence: Recurring, every 1 Day, no expiry β Create 2. Open the runbook β Schedules β Add a schedule β link Daily-OnCall-Midnight 3. Done β each night at midnight it reads the SharePoint list and updates Teams AA automatically.
No monthly maintenance needed. Just keep the calendar updated and click Sync whenever you change it.