Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing Microsoft.Graph.Identity.Governance v2.23.0 gobbles up 400-500 MB of RAM #2981

Open
o-l-a-v opened this issue Oct 1, 2024 · 1 comment
Labels
status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience

Comments

@o-l-a-v
Copy link

o-l-a-v commented Oct 1, 2024

Describe the bug

Simply importing Microsoft.Graph.Identity.Governance v2.23.0 gobbles up more than 500MB of RAM / memory!

This is especially a problem when running in memory restricted environments like Azure Automation Account.

Screenshots going from pwsh -noprofile with PowerShell v7.4.5 x64 on Windows 11 23H2.

Clean start, idles at around 30 MB.

image

Import Microsoft.Graph.Authentication, does not take up much. Great.

image

Importing Microsoft.Graph.Identity.Governance makes pwsh.exe idle at almost 500 MB. Ouch. I've seen this idle around 500-600 MB at other times.

image

cookie-monster

Expected behavior

Don't take hundreds of MB of RAM.

How to reproduce

See "Describe the bug"

SDK Version

2.23.0

Latest version known to work for scenario above?

No response

Known Workarounds

In resource limited environments, like Azure Automation Account, use Microsoft.Graph.Authentication only with cmdlet Invoke-MgGraphRequest to do API requests, instead of using other resource heavy Microsoft.Graph modules.

In my example, replace:

Microsoft.Graph.Identity.Governance\Get-MgIdentityGovernancePrivilegedAccessGroupAssignmentScheduleInstance -All -Filter (
    'groupId eq ''{0}'' and endDateTime ne null' -f $PimGroup.'id'
)

with

(
    Microsoft.Graph.Authentication\Invoke-MgGraphRequest -Method 'Get' -Uri (
        [uri]::EscapeUriString(
            'https://graph.microsoft.com/v1.0/identityGovernance/privilegedAccess/group/assignmentScheduleInstances?' +
            ('$filter=groupId eq ''{0}'' and endDateTime ne null' -f $PimGroup.'id')
        )
    )
).'value'

You'll have to handle paging yourself with this approach.

Debug output

Click to expand log ```
</details>


### Configuration

_No response_

### Other information

_No response_
@o-l-a-v o-l-a-v added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels Oct 1, 2024
@o-l-a-v
Copy link
Author

o-l-a-v commented Oct 1, 2024

As v2.24.0 was just released and I'm still at work:

image

It seems to be even worse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience
Projects
None yet
Development

No branches or pull requests

1 participant