Skip to content

Instantly share code, notes, and snippets.

@nicolonsky
Created March 11, 2020 09:31
Show Gist options
  • Save nicolonsky/ed657418d9b65f83238661b71f568d54 to your computer and use it in GitHub Desktop.
Save nicolonsky/ed657418d9b65f83238661b71f568d54 to your computer and use it in GitHub Desktop.
Disable self-service purchases
# Disable Office 365 Self-Servicing Purchases
# src: https://docs.microsoft.com/en-us/microsoft-365/commerce/subscriptions/allowselfservicepurchase-powershell?view=o365-worldwide
# Install abd connect MSCommerce services with PowerShell
Install-Module -Name MSCommerce -Scope CurrentUser
Connect-MSCommerce
Get-MSCommerceProductPolicies -PolicyId AllowSelfServicePurchase
# Disable Self-Servicing for all products
Get-MSCommerceProductPolicies -PolicyId AllowSelfServicePurchase | % {Update-MSCommerceProductPolicy -PolicyId $_.PolicyId -ProductId $_.ProductID -Enabled $false}
Get-MSCommerceProductPolicies -PolicyId AllowSelfServicePurchase
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment