Skip to main content
Systems Engineering

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.

Elderly woman receiving assistance from a pharmacist in a pharmacy with product shelves.

In this guide

Share

Microsoft 365 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.

AllowSelfServicePurchase values and what users can do
PowerShell valueAdmin center optionPurchasesTrials
EnabledAllowAllowedAllowed
OnlyTrialsWithoutPaymentMethodAllow for trials onlyBlocked, including after the trial endsOnly trials that need no payment method, for products that offer them
DisabledDo not allowBlockedBlocked

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.

Wooden blocks spelling out '#365 memories' symbolizing daily reflection and nostalgia.
Photo by Ann Hannes on Pexels

#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.

  1. 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
  2. Read the policy and the default for your tenant.
    1Get-MSCommercePolicy -PolicyId AllowSelfServicePurchase

    This returns the description of AllowSelfServicePurchase and its default status for your organisation. It changes nothing.

  3. 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 -NoTypeInformation

    Open 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 OnlyTrialsWithoutPaymentMethod or Disabled; someone chose that deliberately.

  4. 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 CFQ7TTC0LH3L

    The 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.

  5. Approve the list, then block it. Copy the before file to selfservice-products-approved.csv and 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 Disabled twice 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 Copilot, 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.

  6. 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.

  7. 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.

  1. 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.csv

    Every product should read Disabled, apart from those you set to OnlyTrialsWithoutPaymentMethod.

  2. 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.
  3. Allow up to 72 hours. For Teams trials, Microsoft recommends closing and restarting the app before you test.
  4. 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 -RedirectUri parameter 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.
Smartphone displaying VISA on a laptop for online shopping experience.
Photo by Julio Lopez on Pexels

#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 ID 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 CFQ7TTC0LH3L

Restore 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 AllowSelfServicePurchase as Global Reader and flag any product that reads Enabled without 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

This page lists no external sources.

Corrections

No corrections are listed for this page. Some review sweeps corrected pages without naming each one; those are in the corrections log.

Reader Interaction

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.

Loading comments...

Discover more

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.