monkey365 icon indicating copy to clipboard operation
monkey365 copied to clipboard

[Bug]: Error when missing P2 license

Open peppekerstens opened this issue 8 months ago • 3 comments

What happened?
When running monkey365 without a P2 license to collect data, following error is shown

Invoke-Monkey365 -TenantId xxxxxxx -Instance Azure -Collect All -ExportTo html

PropertyNotFoundException: {path]......monkey365\0.95.2\core\api\auth\Connect-MonkeyCloud.ps1:277
Line |
 277 |      if($null -ne $O365Object.Tenant.licensing.EntraIDP2){
     |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | The property 'EntraIDP2' cannot be found on this object. Verify that the property exists.

How to reproduce it
See above (any EntraID without a P2 license I guess)

Expected behavior
A decent message or error, explaining something like 'a EntraID P2 license is required for...'

suggestion; different check if property exists

if($null -ne $O365Object.Tenant.licensing.EntraIDP2){
if ($O365Object.Tenant.PSobject.Properties.licensing -contains "EntraIDP2")

(not tested!) or something like that?

From where are you running Monkey365?

$PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.5.1
PSEdition                      Core
GitCommitId                    7.5.1
OS                             Microsoft Windows 10.0.26100
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Additional context Add any other context about the problem here.

peppekerstens avatar Jun 23 '25 12:06 peppekerstens

Hi @peppekerstens thank you for raising an issue to help improve monkey365. I'll need to verify it and will let you know asap. Regarding licenses, monkey365 will enable/disable collectors and rules depending on the license.

On first steps, Monkey365 tries to get as much information as possible regarding tenant's licensing model. I believe that licensing model is not received by monkey365 and exception is not handle.

Thanks,

silverhack avatar Jun 23 '25 13:06 silverhack

Hi @peppekerstens, I removed the status triage and added the bug label. I believe that the errors come from here and here

I'll rewrite those functions to throw errors and stop jobs if tenant information is not returned.

Thank you for letting me know. I'll update the dev branch asap.

Cheers,

silverhack avatar Jun 23 '25 16:06 silverhack

Hi @peppekerstens I believe it's now fixed on dev branch. Tenant information logic was modified to throw errors if tenant information (licensing model, if tenant is disabled, etc..) is not received for any reason. Could you please test it and to check if it works for you?

Thanks,

silverhack avatar Jun 25 '25 09:06 silverhack

This issue has been automatically marked as stale because it has not had recent activity. We kindly ask you to check again if the issue you reported is still relevant in the current version of Monkey365. If it is, update this issue with a comment, otherwise it will be automatically closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Oct 24 '25 02:10 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale. If the issue is still relevant, feel free to re-open it or open a new one.

github-actions[bot] avatar Nov 07 '25 02:11 github-actions[bot]