Self Service License Purchase Microsoft 365

Self Service License Purchase is turned on by default in Microsoft 365! In this clip part of my PowerShell for Microsoft 365 course on Pluralsight you will learn about this feature – and how to turn it off!

Full PowerShell for Microsoft 365 Course

Video Summary

Here are the key points from the video:

  • The transcript introduces the concept of self-service license purchase in Microsoft 365, allowing users to buy licenses without admin approval, starting with Power Platform products in October 2019.
  • Many administrators were unhappy with this feature, leading to a significant user voice request to disable it. Microsoft responded by postponing the feature and providing a way to turn it off via the MS Commerce PowerShell module.
  • As of February 2021, users can buy licenses for several Microsoft products without admin intervention, but administrators can disable this feature using PowerShell.
  • The transcript details how to install the MS Commerce PowerShell module, connect to it, and view or change the self-service purchase settings, including specific commandlets and steps to disable the feature for individual products or all products.
  • It also covers the end-user experience when trying to purchase licenses and how it changes when the feature is disabled, concluding with troubleshooting tips for common errors encountered while using the PowerShell commands.

For more information, read the transcript blog below, or watch the video above!

Video Transcript

Let’s start by first introducing what self-service license purchase even is inside Microsoft 365 and how it affects us as administrators. We will cover what that is by really going a bit into how it happened and where we’re at today. In October 2019, Microsoft announced the ability for users to purchase licenses without going through IT. Initially, it was to allow users to get premium versions of the Power Platform products, such as Power BI, Power Apps, and Microsoft Flow (as it was called back then), without having to go through IT. In the initial announcement, there was no way for IT to turn it off. As you can guess, a lot of administrators were not too happy about this. This was covered by IT publications, and a user voice request for the ability to block this racked up over 7,000 votes in just a few days, which is honestly a record as far as I know. Luckily, Microsoft listened, and only one month later, there was an announcement postponing the self-service purchase to January 2020 and providing us a way to turn it off for our tenant. To turn it off, Microsoft created a brand new PowerShell module called the MS Commerce PowerShell module, which will be the star of this module that you’re listening to today on how to manage self-service licensed purchases. We will get to the how in just a few minutes, but first, let’s talk about self-service license purchasing today. At the time of recording this course in February 2021, users themselves can buy paid versions of Power BI, Power Apps, Power Automate, Microsoft Project, and Microsoft Visio without going through an administrator. By default, this is turned on and available for every tenant, but administrators can turn it off only via PowerShell, which is what we will learn how to do in this module.

Now that we know the basics of the self-service license purchasing functionality in Microsoft 365, let’s learn how to manage it. This module is on the PowerShell gallery, and similar to the other modules in this course, to install the module, we need to run the install module cmdlet and specify the name of the module, in this case, MS Commerce. To connect, you need to either be a global administrator or a billing administrator, as those are very high roles in terms of what they’re allowed to do. No other role can change the settings for this. To connect to MS Commerce, we will simply run the connect MS Commerce PowerShell cmdlet, which will open a login prompt where we enter our credentials and optionally a second factor of authentication if you have one configured. To view the current configuration, we will run the get MS Commerce product policies PowerShell cmdlet on the policy ID called allow self-service purchase. You can see in the screenshot below the different products and the policy value, you can see if they’re enabled or disabled. If you want to disable a single product, we will first need to get the product by using the get MS Commerce product policies and filtering where the product name is Power Automate in this example. Then we will use the product ID in the update MS Commerce product policy PowerShell cmdlet and set the enabled property to false in order to disable the self-service license purchase for this specific product.

Now that we know the theory, let’s go to the lab environment and see how we can manage self-service license purchasing with PowerShell. I am now in the lab environment, and first of all, let me open up the browser where I am already in the PowerShell gallery. Let’s search for MS Commerce, which is the PowerShell module we’re looking for. The first one is the one we need, MS Commerce by the Microsoft Commerce Platform Experiences team. Let’s go inside, and if we look at the version history, you will notice that this module doesn’t get updated often. Even if there’s a new product that enables the self-service purchase, a lot of it is done on the backend, and you’re not going to have an update to the actual PowerShell module. Similar to the other PowerShell modules, we do have the install cmdlet here that we can just copy and paste in PowerShell. Let me close up this browser and go to the PowerShell ISE. Let’s install the module. I will first get the question if I trust the PowerShell gallery, to which I will say yes. While this is getting installed, let’s take a look at the user experience. What does it look like for a user when they want to buy their own licenses? For this example, I will use Microsoft Power Automate. Here, I’m logged in as Vanessa Lee, who is simply a user in my tenant with no admin rights or anything. If I go to the bottom of the page under pricing, I have the per-user plan. Let me click on buy now. As a user, I can click on buy now. It might ask me to sign in, but since I’m already signed in to Office 365, it detected my user. I am in Canada, and it has already been detected that I’m part of a tenant. Now I can go buy licenses, even two of them. I can add a payment method, and here, as a user with no admin permissions, I can put in my credit card number and start using a premium version of Power Automate without going through my admins. This might be something that you want to leave enabled as an admin, but let’s learn how to disable it if we do not want to allow this in our tenant.

I will close the page here so we can take a look at the result after. I will go back to the ISE and run the connect MS Commerce PowerShell cmdlet. Let me enter my username, so vlad@globomantics.org. Let me enter my password here, and we got the message “Connection established successfully,” so that’s perfect. Now, if we want to see the status of all the different products in our tenant, we will run the get MS Commerce product policies and then use the policy ID to allow self-service purchases. When I run this, I will see all the different products that currently have this functionality enabled by Microsoft. We have Power Automate, Power Apps, Visio Plan 2, Visio Plan 1, Project Plan 3, Project Plan 1, and Power BI Pro. We have the product ID and the policy value. As you can see, all of them are enabled right now, so they’re all available. Let’s say you want to disable it for a single product or one product at a time. First, I will run the same cmdlet, get MS product policies, and simply add a where clause at the end and say where the product name is equal to Power Automate. Then I will save this in a variable called product. If I look at the product now, I have the same information but just for that Power Automate product. To update it, I can run the update MS Commerce product policy, the allow self-service purchase policy, give it the product ID property, and set enabled to false. Let me run it. It does not take any time at all. Now, if I take a look at all of my products again, you will see that Power Automate is disabled and the rest of them are enabled. Let’s take a look at what this now looks like from an end-user point of view. If I go and click on buy now, the same page as before will still detect that I’m logged in, but now instead of allowing me to select how many I want to buy and put in my credit card, I have a message saying, “Your organization does not allow employees to buy Power Automate per user. However, you can ask your admin to assign it to you and others.” You can enter the additional names of people who would need this as well as a message, maybe a business justification for your admin. This way, the admin would have to purchase it through the normal channels and then assign it to you as usual. This is the end-user experience.

If we go back to PowerShell, you could, of course, run the same script that we did before. Let’s say we want to put Project Plan 3 in there, then rerun the get and update. If we look at the result, we have now disabled Project Plan 3 as well. If you want to disable all of them, you can create a nice loop. First, we will run a get MS Commerce product policies on the same policy ID, save it in a variable called products with an S, and then loop through each one of them. For each product in products, update the MS Commerce product policy for the current product that you’re looping on and set it enabled to false. In the past few weeks of recording this video, this threw some random errors from the backend of Microsoft. Let’s see if the demo gods are with me. It looks like we got the error, so I can show it to you. It says, “Failed to update product policy. The remote server returned an error: precondition failed.” However, most of the time, it worked. If not, you can just run a get again, and take a look at all of them. You see it failed for Power Apps, and I can just take the one that failed here and update that one individually. Then we should be all disabled across the board. Let’s double-check. There we go. I have really gotten this error in multiple environments on different products. If you get an error similar to this one, it’s nothing to worry about. Simply rerun the cmdlet, or if not, find the product that it didn’t work within the loop, run it individually, and then you will be good to go.

This is it for this demo in which we have seen how to get the MS Commerce Powershell module. We have even looked at the end-user experience for how to buy your own licenses, what it looks like when it’s enabled versus when it’s disabled, and we have also looked at how to disable it of course using Powershell. This can be done one product at a time or by creating a nice Loop for all of them.