<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>M365 on Alfred van Ster</title><link>https://avanster.tech/tags/m365/</link><description>Recent content in M365 on Alfred van Ster</description><generator>Hugo -- 0.161.1</generator><language>en-us</language><lastBuildDate>Sun, 03 May 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://avanster.tech/tags/m365/index.xml" rel="self" type="application/rss+xml"/><item><title>M365 Security: Unauthorized Mailbox Forwarding Auditor</title><link>https://avanster.tech/library/script-exchange-forwarding-auditor/</link><pubDate>Sun, 03 May 2026 00:00:00 +0000</pubDate><guid>https://avanster.tech/library/script-exchange-forwarding-auditor/</guid><description>&lt;ol&gt;
&lt;li&gt;The Workflow&lt;/li&gt;
&lt;li&gt;The Implementation&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;A classic BEC tactic involves configuring an inbox rule to forward emails to an external address. This script audits an entire Exchange Online tenant for any mailboxes with active forwarding rules to external domains.&lt;/p&gt;
&lt;h3 id="1-the-workflow"&gt;1. The Workflow&lt;/h3&gt;
&lt;p&gt;The script performs the following steps:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Connection:&lt;/strong&gt; Authenticates to Exchange Online via module parameters.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Auditing:&lt;/strong&gt; Iterates through all user mailboxes checking forwarding properties.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Evaluation:&lt;/strong&gt; Compares the forwarding destination against the tenant&amp;rsquo;s accepted domains.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Alerting:&lt;/strong&gt; Outputs a high-priority warning if external exfiltration is detected.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="2-the-implementation"&gt;2. The Implementation&lt;/h3&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-powershell" data-lang="powershell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Connect-ExchangeOnline -ShowBanner:$false
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$AcceptedDomains = (Get-AcceptedDomain).Name
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;foreach&lt;/span&gt; ($Mailbox &lt;span style="color:#66d9ef"&gt;in&lt;/span&gt; (Get-Mailbox -ResultSize Unlimited)) {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;if&lt;/span&gt; ($Mailbox.ForwardingSmtpAddress) {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; $ForwardDestination = $Mailbox.ForwardingSmtpAddress.Replace(&lt;span style="color:#e6db74"&gt;&amp;#34;smtp:&amp;#34;&lt;/span&gt;,&lt;span style="color:#e6db74"&gt;&amp;#34;&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;if&lt;/span&gt; ($ForwardDestination &lt;span style="color:#f92672"&gt;-notmatch&lt;/span&gt; ($AcceptedDomains -join &lt;span style="color:#e6db74"&gt;&amp;#34;|&amp;#34;&lt;/span&gt;)) {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; Write-Host &lt;span style="color:#e6db74"&gt;&amp;#34;⚠️ EXTERNAL FORWARD: &lt;/span&gt;$($Mailbox.UserPrincipalName)&lt;span style="color:#e6db74"&gt; -&amp;gt; &lt;/span&gt;$ForwardDestination&lt;span style="color:#e6db74"&gt;&amp;#34;&lt;/span&gt; -ForegroundColor Red
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item><item><title>Zero-Touch M365 Offboarding with n8n, Docker, and PowerShell</title><link>https://avanster.tech/posts/zero-touch-m365-offboarding/</link><pubDate>Sun, 03 May 2026 00:00:00 +0000</pubDate><guid>https://avanster.tech/posts/zero-touch-m365-offboarding/</guid><description>&lt;h3 id="overview"&gt;Overview&lt;/h3&gt;
&lt;p&gt;In a Managed Service Provider (MSP) environment, manual offboarding is a massive liability. Missing a step when revoking access can lead to data breaches, compliance violations, and wasted licensing costs.&lt;/p&gt;
&lt;p&gt;This guide outlines an architectural approach to &amp;ldquo;Zero-Touch&amp;rdquo; offboarding, leveraging a self-hosted n8n instance running in Docker to trigger a robust PowerShell workflow that interacts directly with the Microsoft Graph API.&lt;/p&gt;
&lt;h3 id="the-architecture"&gt;The Architecture&lt;/h3&gt;
&lt;p&gt;Relying on technicians to manually run scripts on their local machines creates bottlenecks. By containerizing the automation engine, we achieve predictable, auditable execution.&lt;/p&gt;</description></item></channel></rss>