Disable ads in your M365 Tenant, I *think*

We have a A5 licensed tenant at work and yet despite paying Microsoft a significant sum of money every year we still see advertisements for their above and beyond offerings throughout the M365 Apps we use day-to-day.

I’ve received multiple notifications in my Teams to sign-up for a PowerBI Pro trial license. Most recently we had someone report that after a Teams meeting they saw an advertisement for a Teams Premium Trial that included some “AI” non-sense.

I recall trying to find a way to disable this stuff a while back and didn’t find anything at the time.

I checked again today and came across this article: https://learn.microsoft.com/en-ca/microsoft-365/commerce/subscriptions/allowselfservicepurchase-powershell?view=o365-worldwide

In it, they reference a PowerShell module called MSCommerce: https://www.powershellgallery.com/packages/MSCommerce/

While it is not explicitly stated, I took the leap that if you disable Microsoft from offering trials of these products to your users the ads that pop-up in Microsoft Apps should go away too.

Anecdotally, it appears to have worked for us.

Here’s a quick and dirty to disable all of these trial offers in your tenant:

# Install the MSCommerce Module
Install-Module -Name MSCommerce

# Import the module
Import-Module -Name MSCommerce

# Connect to M365 with a Global Admin or Billing Admin account
Connect-MSCommerce

# View the current status of trials in your tenant
Get-MSCommerceProductPolicies -PolicyId AllowSelfServicePurchase

# Disable everything, run this 3-4 times as some cannot be disable until others are disabled first
Get-MSCommerceProductPolicies -PolicyId AllowSelfServicePurchase | Where-Object { $_.PolicyValue -eq "Enabled" } | ForEach-Object { Update-MSCommerceProductPolicy -PolicyId AllowSelfServicePurchase -ProductId $_.ProductId -Value "Disabled"}

# Confirm all trials are disabled
Get-MSCommerceProductPolicies -PolicyId AllowSelfServicePurchase

There is no Disconnect-MSCommerce command so you can either close the PowerShell window or just wait and the login will eventually timeout.

You will likely want to set yourself a monthly reminder, or automate this, as Microsoft continually adds new trials you’ll need to disable.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.