Skip to content

Align resource name and improve performance #6315

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

Open
wants to merge 11 commits into
base: Dev
Choose a base branch
from

Conversation

FabienTschanz
Copy link
Collaborator

@FabienTschanz FabienTschanz commented Jul 11, 2025

Pull Request (PR) description

This PR aligns the naming of the IntuneDeviceConfigurationSCEPCertificatePolicy and improves the performance of the module by either:

  • Replacing pipeline commands with their method counterpart on the object
  • Using foreach instead of Foreach-Object

Additionally, the module import was sped up. Depending on the number of modules to import, improvements of up to 60% can be seen by using -Alias @() -Cmdlet @() -Variable @() -DisableNameChecking [-SkipEditionCheck]. Specifying the alias, cmdlet and variable parameters leads to only loading the functions itself, without populating (and thus discovering / scanning) all of the module again and again to detect any possible alias, cmdlet or variable to export.

Some numbers:

  • Intune export without any changes: ~220 seconds
  • Intune export with improved export: ~150 seconds
  • Importing all Microsoft.Graph modules (default): 140 seconds
  • Importing all Microsoft.Graph modules (improved): 85 seconds

Tests were conducted with PowerShell 7 and Windows PowerShell 5.1, where Windows PowerShell 5.1. was consistently ~20% slower than PS7 during every use case.

Profiling shows that the things the most expensive are the web requests to the backend APIs. If we're able to parallelize the processing of those resources, it would massively speed up export and other configurations.


Second part of this PR is an added -Parallel switch to the Export-M365DSCConfiguration function using PSParallelPipeline in the background as a new dependency. While it's not always guaranteed to bring performance improvements, it certainly can and if it does, then it can an improvement of up to 70% faster export.

The resource consumption is higher when running it in parallel mode, so a recommendation of 8GB of memory was added to the documentation. For sequential operation, this is not necessary.

And lastly, the PR contains changes to the Intune required modules for those who leverage either ConvertFrom-IntuneMobileAppAssignment or ConvertFrom-IntunePolicyAssignment (which is about 90% of the Intune resources).

This Pull Request (PR) fixes the following issues

None.

Task list

  • Added an entry to the change log under the Unreleased section of the file CHANGELOG.md.
    Entry should say what was changed and how that affects users (if applicable), and
    reference the issue being resolved (if applicable).
  • Resource parameter descriptions added/updated in the schema.mof.
  • Resource documentation added/updated in README.md.
  • Resource settings.json file contains all required permissions.
  • Examples appropriately added/updated.
  • Unit tests added/updated.
  • New/changed code adheres to DSC Community Style Guidelines.

@FabienTschanz FabienTschanz force-pushed the fix/names-and-performance branch from fbab7a7 to 08c12cc Compare July 11, 2025 18:38
@FabienTschanz
Copy link
Collaborator Author

Finally, ready for review.

@FabienTschanz
Copy link
Collaborator Author

If we're going to make it breaking, then let's add some more stuff 😄 I updated the description to incorporate the latest changes.

@FabienTschanz FabienTschanz marked this pull request as draft July 14, 2025 22:01
@FabienTschanz FabienTschanz marked this pull request as ready for review July 20, 2025 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants