Skip to content

Microsoft.Graph.Beta.Identity.Governance module is too big and fails on Azure AutomationΒ #2516

@jpawlowski

Description

@jpawlowski

When using Microsoft.Graph.Identity.Governance module in Azure Automation runbooks running inside the Azure sandbox, the memory limitation of 400 MB becomes profoundly serious.

I noticed that the actual size of the Microsoft.Graph.Identity.Governance module is already huge (Version 2.11.1 has 17,131.3 KB), and the beta module is even bigger using 24,481.4 KB of disk space. This gives quite a good indication about the memory consumption of this module.

Importing that module inside a PowerShell 5.1 runbook using Import-Module Microsoft.Graph.Beta.Identity.Governance will often fail in Azure Automation, leading to out of memory exceptions:

ForEach-Object : Exception of type 'System.OutOfMemoryException' was thrown. At C:\usr\src\PSModules\Microsoft.Graph.Beta.Identity.Governance\internal\Microsoft.Graph.Beta.Identity.Governance.inter nal.psm1:34 char:72 + ... th -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OperationStopped: (:) [ForEach-Object], OutOfMemoryException + FullyQualifiedErrorId : System.OutOfMemoryException,Microsoft.PowerShell.Commands.ForEachObjectCommand

I know that I could use Azure Automation Hybrid Worker to run on a dedicated virtual machine. Obviously, this is not the idea of serverless infrastructure which is why I prefer to avoid this. I'm not sure if the memory limits of the Azure Automation sandbox will increase in the future or when (it likely will, after migration to Azure Container Instances was completed). However, this is not what I think would be a satisfactory solution as even today, memory consumption counts as it adds up on scale and Microsoft might expect lots of users running Microsoft Graph PowerShell on Azure Automation more and more.

I was wondering if there was anything wrong with the module as it is becoming simply bigger and bigger, and compared to other Graph modules, it is extremely large already.
If it were by design today, is there anything you could do to improve size and memory consumption as such?

Screenshot comparing sizes of typical Microsoft Graph PowerShell module sizes in Azure Automation

Thanks! πŸ˜„

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions