microsoft / EntraExporter

PowerShell module to export a local copy of an Entra (Azure AD) tenant configuration.
https://aka.ms/EntraExporter
MIT License
572 stars 91 forks source link

Scaling -- option to foreach paralell? #67

Open tobiasboone opened 4 months ago

tobiasboone commented 4 months ago

I work for an organization with a rather large tenant; 1.2 million users, tens of thousands of groups. The export times out. Wondering what recommendations you may have to thread this out so that it can finish. My goal is to get the files exported to blob and then ingest it into Splunk so we can report on the tenant at scale across all users/groups and have it self version.

SamErde commented 4 months ago

What part of the export times out? It's not surprising with that many users, and you probably are dealing with a massive number of groups as well.

My initial thoughts, while certainly not definitive or authoritative, are:

tobiasboone commented 3 months ago

We are actually exporting each thing independently to attain a little better performance:

$EntraOptions=@("Config","AccessReviews","ConditionalAccess","Applications","ServicePrincipals","B2C","B2B","PIM","PIMAzure","PIMAAD","AppProxy","Organization","Domains","EntitlementManagement","Policies","AdministrativeUnits","SKUs","Identity","Roles","Governance","Devices")

Unused Options = All, Users Groups

$EntraOptions | foreach-object -Parallel {

Export-Entra -path $exportpath -TYpe $_

} -ThrottleLimit 15 #######################

The issue is absolutely with users and their groups. It just times out after an hour; often never exporting any users at all. I am able to use the splunk connector for azure to get a copy of the base users on a 24 hour window, but that doesn't grab group memberships at the same time.

TY for the reference to Robust Cloud Command. This may be a way around this with something more custom.

FWIW, a filter on the user export that would allow a user export to occur based on upn's starting with a b c* would be excellent in this tool. That would allow us to run the user export in 26 parallel task streams one for each begining letter of the alphabet.... :)

SamErde commented 3 months ago

Running in parallel may be hurting your throttling limits. Have a look at these two documents:

Try running Export-Entra with Verbose or Debug to see what happens when the operation fails. That might give you a more specific clue about what problem to solve.

merill commented 3 months ago

Do you get an out of memory issue or some other exception?