maester
maester copied to clipboard
Error in Get-MtLicenseInformation when tenant has no licenses
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.
Good catch. Thanks!
Can probably close, per #947. @bwyatt, have you had a chance to install the latest version and re-test?