In This Article


Overview

Microsoft provides self-service purchasing to give an organization's users a chance to try out new technologies and develop solutions that ultimately benefit their company.  This includes purchasing new products with a credit card, or starting a free trial.  Additionally, the purchaser has access to a limited view of the Microsoft 365 Admin Center where they can assign the product's licenses to other people in the organization.

Central procurement and IT teams have visibility to all users who buy and deploy self-service purchase solutions through the Microsoft 365 Admin Center.  Additionally, Admins can turn off self-service purchasing on a per product basis using PowerShell. 

This article covers the process to turn off self-service purchasing for all products, or for an individual product.


Requirements

  • An understanding of basic PowerShell concepts.
  • PowerShell 5.0 running on Windows 10/11, or Windows Server 2016 or newer.
  • PowerShell 6.x/7.x is not supported.
  • The MSCommerce PowerShell module must be installed.
  • A user account with the Global Administrator or Billing Administrator role.
  • The Global Reader role can be used to view/audit the self-service configuration.


Install or Update the MSCommerce PowerShell Module

Open a PowerShell window and run the following command to install the MSCommerce module:

Install-Module -Name MSCommerce -Scope CurrentUser

If the MSCommerce Powershell module is already installed, use the following command to update the module:

Update-Module -Name MSCommerce


Import the MSCommerce Module & Connect

Run the below commands to import the MSCommerce module and connect to the service:

# Import the MSCommerce module
Import-Module -Name MSCommerce

# Connect to the MSCommerce service
Connect-MSCommerce


View the Current Self-Service Status for Each Product

Run the below commands to view the status of all products.  You will use the product's Product ID to disable a product below.

# View the status of all self-service products
Get-MSCommerceProductPolicies -PolicyId AllowSelfServicePurchase


Disable the Purchasing of a Self-Service Product

NOTE

Disabling the purchasing of self-service products will only block users from purchasing new products, or signing up for new trials.  It will not have any effect on existing purchases or trials that are already activated.

Use the following commands to disabled self-service purchasing for a product.  On Line 2 update the Product ID you wish to disable.

# Product ID
$ProductID = "CFQ7TTC0MM8R"

# Disable self-service purchasing for the product
Update-MSCommerceProductPolicy -PolicyId AllowSelfServicePurchase -ProductId $ProductID -Enabled $false


Enable the Purchasing of a Self-Service Product

Use the following commands to enable self-service purchasing for a product.  On Line 2 update the Product ID you wish to enable.

# Product ID
$ProductID = "CFQ7TTC0MM8R"

# Disable self-service purchasing for the product
Update-MSCommerceProductPolicy -PolicyId AllowSelfServicePurchase -ProductId $ProductID -Enabled $true


Disable the Purchasing of All Self-Service Products

To disable all self-service products, use the following PowerShell: 

# Add all product data to a variable
$AllProducts = Get-MSCommerceProductPolicies -PolicyId AllowSelfServicePurchase

# Iterate through each product and disable self-service purchasing
ForEach ($Product in $AllProducts) {
    
    If ($Product.PolicyValue -eq "Enabled") {
        
        Update-MSCommerceProductPolicy -PolicyId AllowSelfServicePurchase -ProductId $Product.ProductID -Enabled $false
    }
}









  • No labels