Block Microsoft 365 Self-Service Purchases and Trials with the MSCommerce PowerShell Module
Block Microsoft 365 self-service purchases and trials product by product with MSCommerce, keep a CSV rollback record, verify the change and deal with existing subscriptions.

In this guide
Table of Contents
Table of contents
Microsoft 365The KBY LexiconMicrosoft 365Microsoft 365 is Microsoft's subscription suite of Office apps and cloud services such as Exchange Online, SharePoint, OneDrive and Teams, run on an Entra ID tenant.
has no single tenant-wide switch for self-service purchases. The AllowSelfServicePurchase policy is set per product, and every new product Microsoft adds starts out allowed. To block self-service purchases and trials, connect with the MSCommerce PowerShell module, save the current setting of every product, then run Update-MSCommerceProductPolicy -PolicyId AllowSelfServicePurchase -ProductId <ProductID> -Value "Disabled" for each product. Use OnlyTrialsWithoutPaymentMethod where you still want free trials. The change only affects purchases and trials made from then on. Existing subscriptions keep running until you take them over or their purchasers cancel them, and Microsoft says the change can take up to 72 hours to apply.
#Context: why self-service purchases need an owner
Self-service purchase lets a user with a non-guest account in a managed Microsoft Entra tenant buy certain products, including Power BI, Power Apps, Power Automate, Project and Visio, with their own credit card. They start from the product website or an in-app prompt. Credit card is the only payment method. The purchaser is billed and is responsible for payment. They also get a limited view of the Microsoft 365 admin center, where they can assign the licences they bought to other users in the same tenant. Self-service trials, such as the Teams Premium trial started from an in-app prompt, are enabled by default.
For a central IT and procurement team this creates subscriptions that sit outside your agreements and pricing, renew automatically on the purchaser’s credit card, and survive the purchaser leaving: other users keep using the product for the subscription term, and it stays active until it is cancelled. Data created in those products belongs to the organisation, and your existing data management and access policies still apply. The question is not whether the data is governed but who decides which products are bought, and on what terms. Self-service purchase isn’t available to government or education tenants, or in India, so those tenants have nothing to block.
This is the same kind of decision as restricting Microsoft 365 group creation to an approved security group: a default that favours individual users, and a tenant-level control that hands the decision back to IT.
#Architecture: one policy, one setting per product
The control is a single policy, AllowSelfServicePurchase, with a separate value for each product and each third-party offer type. There is no parent setting that overrides them. That has three consequences that shape the whole procedure:
- Blocking everything means changing every product. Microsoft states that self-service purchases and trials can’t be turned off for the whole tenant with one command; you turn off each product individually.
- New products arrive enabled. By default every new product allows self-service purchase, so a tenant that was fully blocked last quarter may not be today. The inventory has to be repeated.
- The setting is forward-looking. Changing a value only affects trials or purchases made for that product from that point. Existing trials and purchases are left alone and need a separate clean-up through Billing.
Each Microsoft product takes one of three values. Third-party offer types take only Enabled or Disabled.
| PowerShell value | Admin center option | Purchases | Trials |
|---|---|---|---|
Enabled | Allow | Allowed | Allowed |
OnlyTrialsWithoutPaymentMethod | Allow for trials only | Blocked, including after the trial ends | Only trials that need no payment method, for products that offer them |
Disabled | Do not allow | Blocked | Blocked |
Only some products offer a trial without a payment method. Microsoft’s list currently marks Microsoft Purview Discovery, Planner Plan 1, Teams Exploratory, Teams Premium Introductory Pricing, Visio Plan 1 and Viva Goals that way, and notes that these trials are only available to select customers with an existing subscription agreement. For a product without such a trial, OnlyTrialsWithoutPaymentMethod blocks purchases and leaves no trial to start, so Disabled is the clearer value to set.
Third-party offer types are a separate scope: Software as a Service (SaaS), Power BI Visuals (POWERBIVISUALS), Dynamics 365 Dataverse Apps (DYNAMICSCE) and Dynamics 365 Business Central (DYNAMICSBC). SaaS products subscribed to in the Azure portal aren’t blocked by this policy at all; govern those through Azure.
The same settings are visible in the Microsoft 365 admin center under Settings > Org settings > Services > Self-service trials and purchases. The portal is useful for checking a single product; PowerShell is better for a tenant-wide change because it can save and restore every product’s setting in one pass.

#Implementation: record, pilot, then block every product
Run this from a Windows 10 or later machine. MSCommerce 3.0.1, published to the PowerShell Gallery in August 2026, signs in through Web Account Manager (WAM) and supports Windows only; its minimum PowerShell version is 5.1. Changing policies needs the Global Administrator or Billing Administrator role. Billing Administrator is enough and is the less privileged choice.
- Install, import and connect. Install once per machine, import in every session, then sign in. Multifactor authentication uses the interactive sign-in.
1Install-Module -Name MSCommerce 2Import-Module -Name MSCommerce 3Connect-MSCommerce - Read the policy and the default for your tenant.
1Get-MSCommercePolicy -PolicyId AllowSelfServicePurchaseThis returns the description of
AllowSelfServicePurchaseand its default status for your organisation. It changes nothing. - Save the rollback record before you change anything. List every Microsoft product and every third-party offer type with its current setting, and keep both files with your change record.
1$before = Get-MSCommerceProductPolicies -PolicyId AllowSelfServicePurchase 2$before | Export-Csv -Path .\selfservice-products-before.csv -NoTypeInformation 3Get-MSCommerceProductPolicies -PolicyId AllowSelfServicePurchase -Scope OfferType | 4 Export-Csv -Path .\selfservice-offertypes-before.csv -NoTypeInformationOpen both files. You should see one row per product, with its name, its ProductId and its current value. Stop here if the list is empty or the call fails: you have no record to roll back to. Note any product that is already
OnlyTrialsWithoutPaymentMethodorDisabled; someone chose that deliberately. - Pilot on one product. Pick a product your organisation does not buy centrally, for example Power Automate per user (
CFQ7TTC0LH3L). Read it, change it, read it again.1Get-MSCommerceProductPolicy -PolicyId AllowSelfServicePurchase -ProductId CFQ7TTC0LH3L 2Update-MSCommerceProductPolicy -PolicyId AllowSelfServicePurchase -ProductId CFQ7TTC0LH3L -Value "Disabled" 3Get-MSCommerceProductPolicy -PolicyId AllowSelfServicePurchase -ProductId CFQ7TTC0LH3LThe second read should show
Disabled. Confirm the product shows Do not allow on the admin center page. If the value didn’t change, stop and work through the failure modes below before you go wider. - Approve the list, then block it. Copy the before file to
selfservice-products-approved.csvand delete the rows for any product that must keep its current setting, such as one a team has an approved exception for. Get the change owner to sign off that file: it is exactly what the loop changes, and nothing outside it is touched.1$approved = Import-Csv -Path .\selfservice-products-approved.csv 2foreach ($id in $approved.ProductID) { 3 Update-MSCommerceProductPolicy -PolicyId AllowSelfServicePurchase -ProductId $id -Value "Disabled" 4}Watch the output. If any call returns an error, stop the loop with Ctrl+C, check the failure modes below and re-run it: setting a product to
Disabledtwice does no harm. A product name can map to more than one ProductId; the approved file lists each one. The product list currently includes Windows 365, Microsoft 365 F3, Microsoft CopilotThe KBY LexiconMicrosoft CopilotMicrosoft Copilot is Microsoft's family of AI assistant capabilities; behaviour varies by product and version, so confirm details in vendor documentation. , Teams Essential, Dynamics 365 and Clipchamp Premium as well as the Power Platform products, so check with the teams that own those before you run it. - Allow free trials where you want them. For a product that offers a trial without a payment method, set the trial-only value instead. For example, Visio Plan 1:
1Update-MSCommerceProductPolicy -PolicyId AllowSelfServicePurchase -ProductId CFQ7TTC0HD33 -Value "OnlyTrialsWithoutPaymentMethod"When the trial ends, users can’t buy the product.
- Block third-party offer types if your policy requires it.
1Update-MSCommerceProductPolicy -PolicyId AllowSelfServicePurchase -OfferType SaaS -Value "Disabled" 2Update-MSCommerceProductPolicy -PolicyId AllowSelfServicePurchase -OfferType POWERBIVISUALS -Value "Disabled"
#Validation: prove the setting, then wait for it to apply
Success has three observable parts: every product reads the value you set, the admin center agrees, and no new self-service subscription appears after the change has had time to apply.
- Export the state after the change and compare it with the before file, product by product:
1Get-MSCommerceProductPolicies -PolicyId AllowSelfServicePurchase | 2 Export-Csv -Path .\selfservice-products-after.csv -NoTypeInformation 3Import-Csv -Path .\selfservice-products-after.csvEvery product should read
Disabled, apart from those you set toOnlyTrialsWithoutPaymentMethod. - In the admin center, open Settings > Org settings > Services > Self-service trials and purchases. Each product should show Do not allow or Allow for trials only.
- Allow up to 72 hours. For Teams trials, Microsoft recommends closing and restarting the app before you test.
- Check Billing > Your products for new self-service subscriptions created after the change: on the Products tab, filter on Self-service, and check the Self-service trials tab.
Users may still see a “Get Premium” or upgrade prompt in a product. Microsoft documents that disabling self-service blocks trial and purchase activation but doesn’t necessarily remove those prompts. A prompt alone isn’t a failure; a new subscription is.
#Failure modes
HandleError : Failed to retrieve policy with PolicyId 'AllowSelfServicePurchase', “The underlying connection was closed”. The session is using a TLS version older than 1.2. Enable TLS 1.2 for the session and retry:1[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12- Connect-MSCommerce fails off Windows, or a script passes
-RedirectUri. Since 3.0, sign-in uses WAM on Windows only and the-RedirectUriparameter has been removed. Run from Windows and drop the parameter from older scripts. - Installing 3.0 fails signature validation. Version 3.0 has been unlisted for this reason. Install 3.0.1, which is functionally identical.
- An update is refused. Check the account’s role: Global Reader can only read the policies. Updating needs Billing Administrator or Global Administrator; a partner working on behalf of a customer (AOBO) needs a role set to Global Administrator.
- A product you never saw is enabled months later. Microsoft added it, and new products default to allowing self-service purchase. Re-run the inventory on a schedule.
- Users still have the product. The policy doesn’t touch purchases and trials made before the change. Handle those through Billing, as described under Recovery.

#Security: least privilege and what the policy does not cover
Use Billing Administrator for the change and Global Reader for routine inventory. Global Reader can see a read-only list of the product policies. The admin center page requires Global Administrator, which is a good reason to make tenant-wide changes in PowerShell rather than the portal. Microsoft recommends keeping the number of Global Administrators as low as possible.
The policy also has a data dimension. When a product allows self-service purchase, Microsoft’s Commerce service processes the purchasing user’s directory data outside the Microsoft 365 tenant boundary. It collects a Microsoft Entra IDThe KBY LexiconMicrosoft Entra IDA concise technical definition of Microsoft Entra ID: what it is, how it fits identity architecture, and where engineers must validate before change. v1.0 access token containing the user’s first and last name, email address, IP address, and tenant and user GUIDs, and uses it to issue the licence and send subscription emails. That processing is part of what you allow when a product stays enabled.
Residual risk remains. SaaS bought in the Azure portal is outside this policy. A purchaser can still assign the licences they already own until you take the subscription over. Products bought centrally are unaffected and still need normal licence management; if users end up with both a self-service and a central licence, see fixing MutuallyExclusiveViolation in Microsoft 365 group licensing before you move them.
#Recovery: restore a product’s previous setting
The policy change itself is fully reversible, because Update-MSCommerceProductPolicy sets a value rather than deleting anything. To restore a product, read its row in the before file and set the value it held:
1Import-Csv -Path .\selfservice-products-before.csv
2Update-MSCommerceProductPolicy -PolicyId AllowSelfServicePurchase -ProductId CFQ7TTC0LH3L -Value "Enabled"
3Get-MSCommerceProductPolicy -PolicyId AllowSelfServicePurchase -ProductId CFQ7TTC0LH3LRestore only the product a team needs, and only to the value in the record: a product that was OnlyTrialsWithoutPaymentMethod before the change goes back to that, not to Enabled. Offer types are restored the same way with -OfferType. Allow the same propagation window as the change.
Existing self-service subscriptions are a separate decision, and one of its options removes access. In Billing > Your products, filter on Self-service, select the subscription, then Take control of this subscription. You then have two options:
- Move users to a central subscription. You need an available licence for every user you move. The old subscription is cancelled automatically and the purchaser is emailed. Prefer this: users keep access.
- Cancel subscription. Users with licences lose access to the product. Before you choose it, export the assigned users (Export users on the product’s licence list), confirm with the purchaser and the users’ manager, and buy or assign central licences for anyone who still needs the product. Treat it as a one-way change.
#Keeping self-service purchases blocked
Treat this as a control you re-verify, not a one-off change:
- Monthly: run
Get-MSCommerceProductPolicies -PolicyId AllowSelfServicePurchaseas Global Reader and flag any product that readsEnabledwithout an approved exception. New products appear enabled. - Monthly: review Billing > Your products filtered on Self-service, and the Self-service trials tab, for subscriptions created since the last review.
- Per exception: record who asked for a product to be allowed, the value set and the review date, next to the before and after CSV files.
- Rollback boundary: policy values can always be restored from the record. Cancelling a subscription removes users’ access, so treat it as one-way; moving users keeps their access.
The next safe decision is usually which of the existing self-service subscriptions to centralise. Start with those that have the most assigned users, move them to central licences, and only then cancel what is left.
About this page
Credited to
Dates
Published
Sources
Corrections
No corrections are listed for this page. Some review sweeps corrected pages without naming each one; those are in the corrections log.
Read-only scripts
- Windows devices with no BitLocker recovery key in Entra IDMicrosoft Entra ID, Windows
- Intune devices that haven't synced in N daysMicrosoft Intune
- Mailboxes forwarding to external addressesExchange Online
- BitLocker status of every volume on this PCWindows
Upcoming deadlines
- Intune moves to macOS 15 and laterQ4 2026
- SAP SuccessFactors provisioning: move from basic auth to workload identityNovember 2026
- Intune November release: JIT registration reminder at APNs renewal and automatic JIT for eligible tenantsNovember 2026
Explore KBY
The KBY Brief
A short email about twice a week with new runbooks, configuration traps and fixes from KBY Technologies.
SubscribeRelated articles
Enterprise IT Management
Scope Microsoft Graph Mail Access to Specific Mailboxes with Exchange Online RBAC for Applications
Scope an app's Graph mail access to specific mailboxes with RBAC for Applications in Exchange Online, test it, remove the unscoped Entra grant and keep a tested rollback.
Enterprise IT Management
Microsoft 365 Group Expiration Policy: Staged Rollout, Renewal and Restore
How to enable Microsoft 365 group expiration without a deletion wave: capture the policy, close ownership gaps, pilot on selected groups, widen to all, verify dates, and switch off and restore safely.
Enterprise IT Management
Restricting Microsoft 365 Group Creation to an Approved Security Group
How to limit Microsoft 365 Group creation to one approved security group with the Group.Unified directory setting, including state capture, validation from both sides, failure modes and a tested rollback.
Enterprise IT Management
Microsoft 365 Conditional Access Blocking Legacy Auth: AADSTS53003
How to trace AADSTS53003 and legacy authentication blocks in Entra sign-in logs and remediate clients without weakening Conditional Access.
Discover more
Graduate Learning
Ops Playbook
Lexicon Definitions
Was this useful?
Reports go to the site owner and are used to correct pages. Corrections are listed at /corrections.
Engineering insights, direct to you.
Receive the latest Systems Engineering tutorials, production guides, Engineering Labs and operational best practices.
Comments
Add a thoughtful note on Block Microsoft 365 Self-Service Purchases and Trials with the MSCommerce PowerShell Module. Comments are checked for spam and held for moderation before appearing.