maester icon indicating copy to clipboard operation
maester copied to clipboard

Error in Get-MtLicenseInformation when tenant has no licenses

Open bwyatt opened this issue 8 months ago • 1 comments

I'm running Maester against a mostly empty tenant that I use as a sandbox, and I found an edge case that isn't covered in Get-MtLicenseInformation.

If the tenant owns no licenses, it throws an error every time it's called:

Select-Object: /Users/ben/.local/share/powershell/Modules/Maester/1.0.0/public/Get-MtLicenseInformation.ps1:30:79       
Line |                                                                                                                  
  30 |  … "subscribedSkus" | Select-Object -ExpandProperty servicePlans | Selec …                                       
     |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                 
     | Property "servicePlans" cannot be found.      

When I run the relevant command (Invoke-MtGraphRequest -RelativeUri "subscribedSkus") on its own, I get the following:

@odata.context                                            value
--------------                                            -----
https://graph.microsoft.com/v1.0/$metadata#subscribedSkus {}

It looks like a check is needed to ensure there are subscribedSkus returned before doing any more processing on them.

bwyatt avatar Apr 15 '25 14:04 bwyatt

Good catch. Thanks!

merill avatar Apr 17 '25 22:04 merill

Can probably close, per #947. @bwyatt, have you had a chance to install the latest version and re-test?

SamErde avatar Jul 01 '25 15:07 SamErde

Can probably close, per #947. @bwyatt, have you had a chance to install the latest version and re-test?

Paging @bwyatt? 😊

SamErde avatar Sep 10 '25 20:09 SamErde