Skip to content

[Bug]: Error when missing P2 license #151

@peppekerstens

Description

@peppekerstens

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions