My PowerShell module to manage Entra ID license assignments

A 1000 curses to whoever in Microsoft decided to switch license management from the Entra ID portal to the admin center. I hate it! 😠

1) Previously I could just have the Global Reader role enabled and easily view licenses and plans on a user or group. Now I can’t!

2) If I don’t have the User Admin or License Admin roles enabled, I don’t even see the “Groups” sub tab in the admin center. (See instructions in this blog post, for instance. The “Groups” tab doesn’t appear if I don’t have the correct role).

3) Once I enable all the roles and reach the “Groups” sub-tab, I am stuck on this screen for some reason.

Sometimes it works, mostly it doesn’t! (Tried this from both Firefox and Edge; incognito and all that just in case). Could be coz our firm has a lot of groups assigned to licenses…

4) Even when I do get a list of groups, if I click on one to find the enabled plans, the view goes crazy and takes me back to the top.

5) Previously I could go to a group in the Entra ID portal and find the licenses assigned to it. No such luck in the admin center.

I hate it. 🤬

I have used the Graph API in the past to change license assignments. So I decided to expand on it and have something a bit more proper in place so I don’t have to go through this mess again. I was aware of ConsoleGuiTools and figured I could maybe take advantage of that.

Here’s what I have so far.

Connect to Graph with an account that has permissions.

Import the module (it’s on live anywhere yet, so no screenshots on that).

Update its internal info (this is optional and any of the other cmdlets will run this one if needed). This pulls the licensing info from the tenant + the latest info from Microsoft.

Find the licenses assigned to a group.

Nice view like this thanks to the ConsoleGuiTools module. Notice the counts too. Very useful, just like the Entra portal view.

If I press enter here nothing happens. I exit the view. But if I press  space to select one or more entries, and then press enter, goes through each of the licenses and shows the plans.

Here’s me selecting the first and last license SKUs.

And here are the details.

That is a game changer in itself for me! 🥰

When I exit it also outputs the licenses I selected. (The screenshot below also shows what happens if I don’t do the Update- cmdlet initially. It is run as part of the Get- cmdlet).

This is useful coz I can use it to update any of the assigned plans.

I selected three here to turn them off. (They are currently enabled).

And they will be disabled. Which I can now confirm via the Get- cmdlet:

Still got to tweak and polish things + test stuff. But this has been my yesterday night and today! 🤩 More later.

Update (few hours later): I uploaded the module to PowerShell gallery. Source code on GitHub. I’ve done very minimal testing – view licenses assigned to a user or group; add/ remove service plans on these licenses. Basic functionality. Basic testing.

Update (the following day): Added two new cmdlets + some minor improvements to do the Update-MgLicensingData cmdlet behind the scenes when running any other cmdlet. Plus fixed some bugs – minor stuff.

I am especially pleased with the two new cmdlets I added today – Add-MgAssignedLicense to add a license SKU to a user or group; and Get-MgAvailableLicenses to view all available licenses in a tenant and drill into them in terms of the groups and users assigned to these. The latter is super useful and calls the other cmdlets as needed to show more info. Give it a shot!

Speaking of giving it a shot, I’ve had 3 downloads of the module (the previous version). I was not expecting that!

I need to work on writing some documentation for this. At least as a reference to myself… and also for others if & when someone stumbles on this module and wants to check it out. So far I am pleased with what I created.

One thing I wish I had done differently is add the word “toolkit” to the module name. It’s less of a functiony sort of module as my focus is mostly on getting things done via the TUI (text UI).