Skip to content

[Bug]: #174

@D3nP4

Description

@D3nP4

What happened?
When running Monkey365 with IncludeEntraID = $true, the scan does not finish and appears to enter a loop during the Entra/Graph user collection phase.
The process keeps repeating the same Microsoft Graph beta user queries, followed by:

  • Jobs Collected: 5 or Jobs Collected: 6
  • All Jobs are completed
  • Sleeping for 20000 Milliseconds

This repeats continuously and no final HTML report is written to the output folder.


How to reproduce it
Steps to reproduce the behavior:

  1. Run Monkey365 with Entra included, for example:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force
New-Item -ItemType Directory -Path C:\temp -Force | Out-Null

Import-Module Monkey365 -Force

function Get-TenantLicensingInfo {
    return $null
}

$param = @{
    Instance        = 'Microsoft365'
    TenantId        =' xxxxxx'
    Collect         = @('AdminPortal','ExchangeOnline','MicrosoftTeams','SharePointOnline','Purview')
    IncludeEntraID  = $true
    PromptBehavior  = 'SelectAccount'
    ExportTo        = @('HTML')
    OutDir          = 'C:\temp'
    SaveProject     = $true
    SpoSites        = 'https://xxxx.sharepoint.com'
}

Invoke-Monkey365 @param -Verbose -Debug -InformationAction Continue -WriteLog

Authenticate successfully.

Observe that Monkey365 starts querying Microsoft Graph.

The scan then repeatedly loops on user queries and never reaches report generation.

Expected behavior
Monkey365 should complete the Entra ID data collection phase and continue to report generation.
A final HTML report should be created in the configured output folder instead of the process looping indefinitely.

Screenshots or Logs
Relevant log pattern observed repeatedly:

VERBOSE: [Watch-MonkeyJob] - All Jobs are completed
VERBOSE: [Invoke-MonkeyJob] - Jobs Collected: 5
VERBOSE: [Invoke-MonkeyJob] - Sleeping for 20000 Milliseconds
VERBOSE: [Get-MonkeyMSGraphObject] - https://graph.microsoft.com/beta/users/<id>?$select=...

This sequence repeats continuously with the same few user objects being queried again and again.

Additional related observations:

When IncludeEntraID = $false, the scan is more stable.

With IncludeEntraID = $true, the process appears stuck in an Entra/Graph user enumeration loop.

No final index.html report is written when the loop occurs.

From where are you running Monkey365?
Please, complete the following information:

Resource: Workstation

OS: Windows

PowerShell Version [$PsVersionTable]: Windows PowerShell 5.1

Monkey365 Version: 0.96.5

Others:

Running with interactive login (PromptBehavior = 'SelectAccount')

SharePoint tenant root URL: https://xxx.sharepoint.com

SharePoint autodetection was problematic, so SpoSites was used

The issue specifically occurs when IncludeEntraID = $true

Additional context
There were multiple issues observed during testing:

SharePoint autodetection initially failed with:

Not connected to SharePointOnline

Unable to connect SharePoint online. No valid host was found

Get-TenantLicensingInfo also produced warnings earlier:

Unable to get information from Tenant

EIDTenantError

To reduce noise, Get-TenantLicensingInfo was temporarily overridden to return $null.

Even after that change, the scan still loops when IncludeEntraID = $true.

The behavior strongly suggests the issue is related to Entra ID / Microsoft Graph user collection rather than authentication itself, because authentication succeeds and Graph requests begin successfully.

The loop seems to repeatedly process the same small set of users instead of progressing to completion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions