Microsoft PowerShell License API Retirement

Microsoft Graph API PowerShell

The Azure AD Graph and MSOnline PowerShell licensing API is scheduled for retirement on the 26th of August, 2022:

Microsoft License API Retirement

Migrating to the new Graph API is exciting news – great new technology with new features!

Or at least that’s what you’d expect until you start working with the new API…

The sheer complexity of moving from the basic ADAL authentication to the MSAL-based PowerShell graph API will shake up many admins.

Sure, if you’re working full-time with Office 365 management and have the opportunity to take your PowerShell skills for a daily walk – no problem.

Unfortunately, Microsoft seems unable to grasp the daily life of thousands and thousands of admins working with Office 365.

Many admins need to cover many technologies like networks, databases, and end-user support. Unfortunately, they don’t have the time to sit down and learn a new PowerShell API every six months.

Especially not a flawed API that represents some setbacks compared to previous solutions.

Here’s an example.

Extracting a List of Service Plans per Licensing Plan

Let’s look at extracting a list of Service Plans enabled in a particular user-assigned License Plan.

First, we use the MSOnline PowerShell API.

We grab a user, have a look at the assigned License Plans, and then list the Service Plans in the first License Plan:

PS C:\> $User = Get-MsolUser -UserPrincipalName hans.c.orsted@azure.skrubbeltrang.com
PS C:\> $User.Licenses

ExtensionData          : System.Runtime.Serialization.ExtensionDataObject
AccountSku             : Microsoft.Online.Administration.AccountSkuIdentifier
AccountSkuId           : skrubbeltrang:ENTERPRISEPREMIUM
GroupsAssigningLicense : {064dcb19-52f9-4779-bdfd-ce7c12f856f6}
ServiceStatus          : {Microsoft.Online.Administration.ServiceStatus, Microsoft.Online.Administration.ServiceStatus, Microsoft.Online.Administration.ServiceStatus, Microsoft.Online.Administration.ServiceStatus...}

PS C:\> $User.Licenses[0].ServiceStatus
ServicePlan                        ProvisioningStatus
-----------                        ------------------
VIVA_LEARNING_SEEDED               Success
Nucleus                            Success
ContentExplorer_Standard           Success
MIP_S_Exchange                     Success
MICROSOFT_COMMUNICATION_COMPLIANCE Success
GRAPH_CONNECTORS_SEARCH_INDEX      Success
Content_Explorer                   Success
POWER_VIRTUAL_AGENTS_O365_P3       Success
CDS_O365_P3                        Success
PROJECT_O365_P3                    Success
EXCEL_PREMIUM                      Disabled
MTP                                Success
DYN365_CDS_O365_P3                 Success
MICROSOFTBOOKINGS                  Disabled
RECORDS_MANAGEMENT                 Success
INFO_GOVERNANCE                    Disabled
DATA_INVESTIGATIONS                Disabled
CUSTOMER_KEY                       Disabled
COMMUNICATIONS_DLP                 Success
COMMUNICATIONS_COMPLIANCE          Success
M365_ADVANCED_AUDITING             Success
INFORMATION_BARRIERS               Success
KAIZALA_STANDALONE                 Disabled
MICROSOFT_SEARCH                   Success
PREMIUM_ENCRYPTION                 Success
WHITEBOARD_PLAN3                   Success
MIP_S_CLP2                         Success
MIP_S_CLP1                         Success
MYANALYTICS_P2                     Success
PAM_ENTERPRISE                     Success
BPOS_S_TODO_3                      Success
FORMS_PLAN_E5                      Disabled
STREAM_O365_E5                     Success
THREAT_INTELLIGENCE                Success
Deskless                           Success
FLOW_O365_P3                       Success
POWERAPPS_O365_P3                  Success
TEAMS1                             Success
ADALLOM_S_O365                     Success
EQUIVIO_ANALYTICS                  Success
LOCKBOX_ENTERPRISE                 Success
EXCHANGE_ANALYTICS                 Success
SWAY                               Success
ATP_ENTERPRISE                     Success
MCOEV                              Success
MCOMEETADV                         Success
BI_AZURE_P2                        Success
INTUNE_O365                        PendingActivation
PROJECTWORKMANAGEMENT              Success
RMS_S_ENTERPRISE                   Success
YAMMER_ENTERPRISE                  Success
OFFICESUBSCRIPTION                 Success
MCOSTANDARD                        Success
EXCHANGE_S_ENTERPRISE              Success
SHAREPOINTENTERPRISE               Success
SHAREPOINTWAC                      Success

Consider how easy and logical this is.

License Plans are available as a list.

Service Plans are available as a sub-list on each of the License Plans they are part of. This makes complete sense.

Now let’s have a look at the new and nifty Microsoft Graph API:

PS C:\> $User = Get-MgUser -UserId hans.c.orsted@azure.skrubbeltrang.com -Property AssignedLicenses,AssignedPlans
PS C:\> $User.AssignedLicenses
DisabledPlans                                                                                                                                               SkuId
-------------                                                                                                                                               -----
{531ee2f8-b1cb-453b-9c21-d2180d014ca5, 199a5c09-e0ca-4e37-8f7c-b05d533e1ea2, e26c2fcc-ab91-4a61-b35c-03cdc8dddf66, 46129a58-a698-46f0-aa5b-17f6586297d9...} c7df2760-2c81-4ef7-b578-5b5392b571df

PS C:\> $User.AssignedPlans
AssignedDateTime       CapabilityStatus Service                       ServicePlanId
----------------       ---------------- -------                       -------------
6/18/2022 3:42:49 PM   Enabled          exchange                      33c4f319-9bdd-48d6-9c4d-410b750a4a5a
6/18/2022 3:42:49 PM   Enabled          Adallom                       8c098270-9dd4-4350-9b30-ba4703f3b36b
6/18/2022 3:42:49 PM   Enabled          exchange                      2f442157-a11c-46b9-ae5b-6e39ff4e5849
6/18/2022 3:42:49 PM   Enabled          CRM                           28b0fa46-c39a-4188-89e2-58e979a6b014
6/18/2022 3:42:49 PM   Enabled          MicrosoftStream               6c6042f5-6f01-4d67-b8c1-eb99d36eed3e
6/18/2022 3:42:49 PM   Enabled          exchange                      b1188c4c-1b36-4018-b48b-ee07604f6feb
6/18/2022 3:42:49 PM   Enabled          YammerEnterprise              7547a3fe-08ee-4ccb-b430-5077c5041653
6/18/2022 3:42:49 PM   Enabled          exchange                      617b097b-4b93-4ede-83de-5f075bb5fb2f
6/18/2022 3:42:49 PM   Enabled          CRM                           afa73018-811e-46e9-988f-f75d2b1b8430
6/18/2022 3:42:49 PM   Enabled          exchange                      41fcdd7d-4733-4863-9cf4-c65b83ce2df4
6/18/2022 3:42:49 PM   Enabled          Deskless                      8c7d2df8-86f0-4902-b2ed-a0458298f3b3
6/18/2022 3:42:49 PM   Enabled          ProcessSimple                 07699545-9485-468e-95b6-2fca3738be01
6/18/2022 3:42:49 PM   Enabled          MicrosoftCommunicationsOnline 3e26ee1f-8a5f-4d52-aee2-b81ce45c8f40
6/18/2022 3:42:49 PM   Enabled          SharePoint                    5dbe027f-2339-4123-9542-606e4d348a72
6/18/2022 3:42:49 PM   Enabled          MicrosoftCommunicationsOnline 0feaeb32-d00e-4d66-bd5a-43b5b83db82c
6/18/2022 3:42:49 PM   Enabled          MIPExchangeSolutions          cd31b152-6326-4d1b-ae1b-997b625182e6
6/18/2022 3:42:49 PM   Enabled          exchange                      65cc641f-cccd-4643-97e0-a17e3045e541
6/18/2022 3:42:49 PM   Enabled          To-Do                         3fb82609-8c27-4f7b-bd51-30634711ee67
6/18/2022 3:42:49 PM   Enabled          exchange                      c4801e8a-cb58-4c35-aca6-f2dcc106f287
6/18/2022 3:42:49 PM   Enabled          exchange                      9f431833-0334-42de-a7dc-70aa40db46db
6/18/2022 3:42:49 PM   Enabled          MicrosoftOffice               43de0ff5-c92c-492b-9116-175376d08c38
6/18/2022 3:42:49 PM   Enabled          exchange                      efb87545-963c-4e0d-99df-69c6916d9eb0
6/18/2022 3:42:49 PM   Enabled          exchange                      34c0d7a0-a70f-4668-9238-47f9fc208882
6/18/2022 3:42:49 PM   Enabled          ccibotsprod                   ded3d325-1bdc-453e-8432-5bac26d7a014
6/18/2022 3:42:49 PM   Enabled          exchange                      6dc145d6-95dd-4191-b9c3-185575ee6f6b
6/18/2022 3:42:49 PM   Enabled          exchange                      efb0351d-3b08-4503-993d-383af8de41e3
6/18/2022 3:42:49 PM   Enabled          PowerAppsService              9c0dab89-a30c-4117-86e7-97bda240acd2
6/18/2022 3:42:49 PM   Enabled          SharePoint                    e95bec33-7c88-4a70-8e19-b10bd9d0c014
6/18/2022 3:42:49 PM   Enabled          M365CommunicationCompliance   a413a9ff-720c-4822-98ef-2f37c2a21f4c
6/18/2022 3:42:49 PM   Enabled          exchange                      5136a095-5cf0-4aff-bec3-e84448b38ea5
6/18/2022 3:42:49 PM   Enabled          ProjectWorkManagement         b737dad2-2f6c-4c65-90e3-ca563267e8b9
6/18/2022 3:42:49 PM   Enabled          Sway                          a23b959c-7ce8-4e57-9140-b90eb88a9e97
6/18/2022 3:42:49 PM   Enabled          WhiteboardServices            4a51bca5-1eff-43f5-878c-177680f191af
6/18/2022 3:42:49 PM   Enabled          exchange                      8e0c0a52-6a6c-4d40-8370-dd62790dcd70
6/18/2022 3:42:49 PM   Enabled          TeamspaceAPI                  57ff2da0-773e-42df-b2af-ffb7a2317929
6/18/2022 3:42:49 PM   Enabled          PowerBI                       70d33638-9c74-4d01-bfd3-562de28bd4ba
6/18/2022 3:42:49 PM   Enabled          MicrosoftCommunicationsOnline 4828c8ec-dc2e-4779-b502-87ac9ce28ab7
6/18/2022 3:42:49 PM   Enabled          MicrosoftThreatProtection     bf28f719-7844-4079-9c78-c1307898e192
6/18/2022 3:42:49 PM   Enabled          exchange                      a6520331-d7d4-4276-95f5-15c0933bc757
6/18/2022 3:42:49 PM   Enabled          ProjectProgramsAndPortfolios  b21a6b06-1988-436e-a07b-51ec6d9f52ad
6/18/2022 3:42:49 PM   Enabled          RMSOnline                     bea4c11e-220a-4e6d-8eb8-8ea15d019f90
6/18/2022 3:42:49 PM   Enabled          LearningAppServiceInTeams     b76fb638-6ba6-402a-b9f9-83d28acb3d86
6/18/2022 3:42:49 PM   Enabled          exchange                      4de31727-a228-4ec3-a5bf-8e45b5ca48cc
6/18/2022 3:41:30 PM   Deleted          exchange                      46129a58-a698-46f0-aa5b-17f6586297d9
6/18/2022 3:41:30 PM   Deleted          OfficeForms                   e212cbc7-0961-4c40-9825-01117710dcb1
6/18/2022 3:41:30 PM   Deleted          MicrosoftOffice               531ee2f8-b1cb-453b-9c21-d2180d014ca5
6/18/2022 3:41:30 PM   Deleted          exchange                      6db1f1db-2b46-403f-be40-e39395f08dbb
6/18/2022 3:41:30 PM   Deleted          exchange                      e26c2fcc-ab91-4a61-b35c-03cdc8dddf66
6/18/2022 3:41:30 PM   Deleted          MicrosoftKaizala              0898bdbb-73b0-471a-81e5-20f1fe4dd66e
6/18/2022 3:41:30 PM   Deleted          exchange                      199a5c09-e0ca-4e37-8f7c-b05d533e1ea2
11/24/2021 10:16:46 AM Deleted          To-Do                         5e62787c-c316-451f-b873-1d05acd4d12c
11/22/2021 9:39:06 AM  Deleted          MicrosoftCommunicationsOnline 505e180f-f7e0-4b65-91d4-00d670bbd18c
11/22/2021 9:39:06 AM  Deleted          exchange                      176a09a6-7ec5-4039-ac02-b2791c6ba793
11/21/2021 7:49:21 PM  Deleted          SharePoint                    13696edf-5a08-49f6-8134-03083ed8ba30
11/21/2021 7:49:21 PM  Deleted          OfficeForms                   159f4cd6-e380-449f-a816-af1a9ef76344
11/21/2021 7:48:29 PM  Deleted          WhiteboardServices            94a54592-cd8b-425e-87c6-97868b000b91
11/9/2021 5:33:08 PM   Deleted          exchange                      9aaf7827-d63c-4b61-89c3-182f06f82e5c

On the positive side, we now see information on the assigned date, which may be helpful for historical tracking.

But good luck with understanding which License Plan was used to assign the various Service Plans.

The Service Plan information is bulked together with no indication of the License Plan through which it was assigned.

Compared to the way the MSOnline API is designed, this seems like a step back.

If you have any logic in your existing scripts that need to know Service Plan to License Plan relationships per user, you’ll need a second command, the Get-MgUserLicenseDetail:

PS C:\WINDOWS\system32> Get-MgUserLicenseDetail -UserId hans.c.orsted@azure.skrubbeltrang.com | fl

Id                   : YTlJwaYrrkG0YuPn5NrmMNA7J8L33xVCnvUse8-wZCU
ServicePlans         : {MICROSOFT_SEARCH, WHITEBOARD_PLAN2, FORMS_PLAN_E1, EXCHANGE_S_FOUNDATION...}
SkuId                : c2273bd0-dff7-4215-9ef5-2c7bcfb06425
SkuPartNumber        : OFFICESUBSCRIPTION
AdditionalProperties : {}
Id                   : YTlJwaYrrkG0YuPn5NrmMGAn38eBLPdOtXhbU5K1cd8
ServicePlans         : {VIVA_LEARNING_SEEDED, Nucleus, ContentExplorer_Standard, MIP_S_Exchange...}
SkuId                : c7df2760-2c81-4ef7-b578-5b5392b571df
SkuPartNumber        : ENTERPRISEPREMIUM
AdditionalProperties : {}

PS C:\WINDOWS\system32> (Get-MgUserLicenseDetail -UserId hans.c.orsted@azure.skrubbeltrang.com)[1].ServicePlans
AppliesTo ProvisioningStatus ServicePlanId                        ServicePlanName
--------- ------------------ -------------                        ---------------
User      Success            b76fb638-6ba6-402a-b9f9-83d28acb3d86 VIVA_LEARNING_SEEDED
Company   Success            db4d623d-b514-490b-b7ef-8885eee514de Nucleus
Company   Success            2b815d45-56e4-4e3a-b65c-66cb9175b560 ContentExplorer_Standard
User      Success            cd31b152-6326-4d1b-ae1b-997b625182e6 MIP_S_Exchange
User      Success            a413a9ff-720c-4822-98ef-2f37c2a21f4c MICROSOFT_COMMUNICATION_COMPLIANCE
User      Success            a6520331-d7d4-4276-95f5-15c0933bc757 GRAPH_CONNECTORS_SEARCH_INDEX
Company   Success            d9fa6af4-e046-4c89-9226-729a0786685d Content_Explorer
User      Success            ded3d325-1bdc-453e-8432-5bac26d7a014 POWER_VIRTUAL_AGENTS_O365_P3
User      Success            afa73018-811e-46e9-988f-f75d2b1b8430 CDS_O365_P3
User      Success            b21a6b06-1988-436e-a07b-51ec6d9f52ad PROJECT_O365_P3
User      Disabled           531ee2f8-b1cb-453b-9c21-d2180d014ca5 EXCEL_PREMIUM
User      Success            bf28f719-7844-4079-9c78-c1307898e192 MTP
User      Success            28b0fa46-c39a-4188-89e2-58e979a6b014 DYN365_CDS_O365_P3
User      Disabled           199a5c09-e0ca-4e37-8f7c-b05d533e1ea2 MICROSOFTBOOKINGS
User      Success            65cc641f-cccd-4643-97e0-a17e3045e541 RECORDS_MANAGEMENT
User      Disabled           e26c2fcc-ab91-4a61-b35c-03cdc8dddf66 INFO_GOVERNANCE
User      Disabled           46129a58-a698-46f0-aa5b-17f6586297d9 DATA_INVESTIGATIONS
User      Disabled           6db1f1db-2b46-403f-be40-e39395f08dbb CUSTOMER_KEY
User      Success            6dc145d6-95dd-4191-b9c3-185575ee6f6b COMMUNICATIONS_DLP
User      Success            41fcdd7d-4733-4863-9cf4-c65b83ce2df4 COMMUNICATIONS_COMPLIANCE
User      Success            2f442157-a11c-46b9-ae5b-6e39ff4e5849 M365_ADVANCED_AUDITING
User      Success            c4801e8a-cb58-4c35-aca6-f2dcc106f287 INFORMATION_BARRIERS
User      Disabled           0898bdbb-73b0-471a-81e5-20f1fe4dd66e KAIZALA_STANDALONE
Company   Success            94065c59-bc8e-4e8b-89e5-5138d471eaff MICROSOFT_SEARCH
User      Success            617b097b-4b93-4ede-83de-5f075bb5fb2f PREMIUM_ENCRYPTION
User      Success            4a51bca5-1eff-43f5-878c-177680f191af WHITEBOARD_PLAN3
User      Success            efb0351d-3b08-4503-993d-383af8de41e3 MIP_S_CLP2
User      Success            5136a095-5cf0-4aff-bec3-e84448b38ea5 MIP_S_CLP1
User      Success            33c4f319-9bdd-48d6-9c4d-410b750a4a5a MYANALYTICS_P2
User      Success            b1188c4c-1b36-4018-b48b-ee07604f6feb PAM_ENTERPRISE
User      Success            3fb82609-8c27-4f7b-bd51-30634711ee67 BPOS_S_TODO_3
User      Disabled           e212cbc7-0961-4c40-9825-01117710dcb1 FORMS_PLAN_E5
User      Success            6c6042f5-6f01-4d67-b8c1-eb99d36eed3e STREAM_O365_E5
User      Success            8e0c0a52-6a6c-4d40-8370-dd62790dcd70 THREAT_INTELLIGENCE
User      Success            8c7d2df8-86f0-4902-b2ed-a0458298f3b3 Deskless
User      Success            07699545-9485-468e-95b6-2fca3738be01 FLOW_O365_P3
User      Success            9c0dab89-a30c-4117-86e7-97bda240acd2 POWERAPPS_O365_P3
User      Success            57ff2da0-773e-42df-b2af-ffb7a2317929 TEAMS1
User      Success            8c098270-9dd4-4350-9b30-ba4703f3b36b ADALLOM_S_O365
User      Success            4de31727-a228-4ec3-a5bf-8e45b5ca48cc EQUIVIO_ANALYTICS
User      Success            9f431833-0334-42de-a7dc-70aa40db46db LOCKBOX_ENTERPRISE
User      Success            34c0d7a0-a70f-4668-9238-47f9fc208882 EXCHANGE_ANALYTICS
User      Success            a23b959c-7ce8-4e57-9140-b90eb88a9e97 SWAY
Company   Success            f20fedf3-f3c3-43c3-8267-2bfdd51c0939 ATP_ENTERPRISE
User      Success            4828c8ec-dc2e-4779-b502-87ac9ce28ab7 MCOEV
User      Success            3e26ee1f-8a5f-4d52-aee2-b81ce45c8f40 MCOMEETADV
User      Success            70d33638-9c74-4d01-bfd3-562de28bd4ba BI_AZURE_P2
Company   PendingActivation  882e1d05-acd1-4ccb-8708-6ee03664b117 INTUNE_O365
User      Success            b737dad2-2f6c-4c65-90e3-ca563267e8b9 PROJECTWORKMANAGEMENT
User      Success            bea4c11e-220a-4e6d-8eb8-8ea15d019f90 RMS_S_ENTERPRISE
User      Success            7547a3fe-08ee-4ccb-b430-5077c5041653 YAMMER_ENTERPRISE
User      Success            43de0ff5-c92c-492b-9116-175376d08c38 OFFICESUBSCRIPTION
User      Success            0feaeb32-d00e-4d66-bd5a-43b5b83db82c MCOSTANDARD
User      Success            efb87545-963c-4e0d-99df-69c6916d9eb0 EXCHANGE_S_ENTERPRISE
User      Success            5dbe027f-2339-4123-9542-606e4d348a72 SHAREPOINTENTERPRISE
User      Success            e95bec33-7c88-4a70-8e19-b10bd9d0c014 SHAREPOINTWAC

It’s not a big deal, but it will require some tweaking to get existing MSOnline scripts converted to reflect this new data structure.

Frustration is Growing

At this moment, there are just over two months left before the MSOnline PowerShell licensing API will die.

The frustration is reaching a boiling point concerning the many scripting changes coming up (as seen on the MS Tech Community):

As mentioned before, it's quite frustrating that the automation interfaces for Azure and Microsoft 365 are in a constant state of flux

announcing the deprecation of the MSOL and Azure modules in December 2022 when there are still known limitations and key functionality still in beta, and you haven't even written the guidance and tools for migrating existing scripts to the product intended to replace them, is just disrespectful to your customer's patience and time

Sometimes I'm not sure if Microsoft's idea is to drive regular administrators into madness

You’ll see similar types of feedback for the announced change in Exchange Online mailbox name attribute.

Change in naming convention of user's Name parameter

This is another fundamental change with short notice that has triggered some very negative feedback from the admin community:

There are going to be lots of random admin scripts that break because of this. Even if we update everything, there are years of online examples and documentation that will be out of date.

Please get a Principal Engineer review on this from someone outside the team implementing this approach. And take into consideration the long term confusion this will create for customers.

This doesn't make any sense. I've had 3 or 4 sync conflicts in 8+ years, all easily fixed. This 'solution' will cost me at least a week of reviews.

Easy365Manager With MS Graph Support

If you’re using Easy365Manager you are already saving a lot of time on daily Office 365 administration.

You’ll also be happy to hear that Easy365Manager will support the new Graph API in the next major update.

Among the many benefits, Easy365Manager lets you manage Office 365 licenses with ease:

Did you like this post? Maybe your friends will too!