M365 Service Plans mapping

A few days ago I posted how to create a list of all licensing SKUs and their ids.

That code was something along these lines:

That creates a hash table I can lookup:

Today I wanted to do the same for service plans. And also find the SKUs associated with a service plan.

Example usage (getting the service plan Id of “Exchange Online (Plan 2)” in “Office 365 E3”:

 

Now I can do the following:

The Skus key is an array.