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

Export-M365DSCConfiguration loads all DSCResources #1745

Closed
andikrueger opened this issue Feb 8, 2022 · 2 comments · Fixed by #2115 or #2123
Closed

Export-M365DSCConfiguration loads all DSCResources #1745

andikrueger opened this issue Feb 8, 2022 · 2 comments · Fixed by #2115 or #2123
Labels

Comments

@andikrueger
Copy link
Collaborator

Details of the scenario you tried and the problem that is occurring

Running the following lines of code will load all DSCResources within the module:

Export-M365DSCConfiguration -Components @("TeamsChannel", "TeamsTeam") -Credential $Credential

Verbose logs showing the problem

VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.22.202.1\DSCResources\MSFT_AADApplication\MSFT_AADApplication.psm1'.
VERBOSE: Importing function 'Export-TargetResource'.
VERBOSE: Importing function 'Get-TargetResource'.
VERBOSE: Importing function 'Set-TargetResource'.
VERBOSE: Importing function 'Test-TargetResource'.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.22.202.1\DSCResources\MSFT_AADConditionalAccessPolicy\MSFT_AADConditionalAccessPolicy.psm1'.
VERBOSE: Importing function 'Export-TargetResource'.
VERBOSE: Importing function 'Get-TargetResource'.
VERBOSE: Importing function 'Set-TargetResource'.
VERBOSE: Importing function 'Test-TargetResource'.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.22.202.1\DSCResources\MSFT_AADGroup\MSFT_AADGroup.psm1'.
VERBOSE: Importing function 'Export-TargetResource'.
VERBOSE: Importing function 'Get-TargetResource'.
VERBOSE: Importing function 'Set-TargetResource'.
VERBOSE: Importing function 'Test-TargetResource'.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.22.202.1\DSCResources\MSFT_AADGroupLifecyclePolicy\MSFT_AADGroupLifecyclePolicy.psm1'.
VERBOSE: Importing function 'Export-TargetResource'.
VERBOSE: Importing function 'Get-TargetResource'.
VERBOSE: Importing function 'Set-TargetResource'.
VERBOSE: Importing function 'Test-TargetResource'.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.22.202.1\DSCResources\MSFT_AADGroupsNamingPolicy\MSFT_AADGroupsNamingPolicy.psm1'.
VERBOSE: Importing function 'Export-TargetResource'.
VERBOSE: Importing function 'Get-TargetResource'.
VERBOSE: Importing function 'Set-TargetResource'.
VERBOSE: Importing function 'Test-TargetResource'.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.22.202.1\DSCResources\MSFT_AADGroupsSettings\MSFT_AADGroupsSettings.psm1'.
VERBOSE: Importing function 'Export-TargetResource'.
VERBOSE: Importing function 'Get-TargetResource'.
VERBOSE: Importing function 'Set-TargetResource'.
VERBOSE: Importing function 'Test-TargetResource'.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.22.202.1\DSCResources\MSFT_AADNamedLocationPolicy\MSFT_AADNamedLocationPolicy.psm1'.
VERBOSE: Importing function 'Export-TargetResource'.
VERBOSE: Importing function 'Get-TargetResource'.
VERBOSE: Importing function 'Set-TargetResource'.
VERBOSE: Importing function 'Test-TargetResource'.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.22.202.1\DSCResources\MSFT_AADRoleDefinition\MSFT_AADRoleDefinition.psm1'.
VERBOSE: Importing function 'Export-TargetResource'.
VERBOSE: Importing function 'Get-TargetResource'.
VERBOSE: Importing function 'Set-TargetResource'.
VERBOSE: Importing function 'Test-TargetResource'.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.22.202.1\DSCResources\MSFT_AADServicePrincipal\MSFT_AADServicePrincipal.psm1'.
VERBOSE: Importing function 'Export-TargetResource'.
VERBOSE: Importing function 'Get-TargetResource'.
VERBOSE: Importing function 'Set-TargetResource'.
VERBOSE: Importing function 'Test-TargetResource'.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.22.202.1\DSCResources\MSFT_AADTenantDetails\MSFT_AADTenantDetails.psm1'.
VERBOSE: Importing function 'Export-TargetResource'.
VERBOSE: Importing function 'Get-TargetResource'.
VERBOSE: Importing function 'Set-TargetResource'.
VERBOSE: Importing function 'Test-TargetResource'.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.22.202.1\DSCResources\MSFT_AADTokenLifetimePolicy\MSFT_AADTokenLifetimePolicy.psm1'.
VERBOSE: Importing function 'Export-TargetResource'.
VERBOSE: Importing function 'Get-TargetResource'.
VERBOSE: Importing function 'Set-TargetResource'.
VERBOSE: Importing function 'Test-TargetResource'.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.22.202.1\DSCResources\MSFT_EXOAcceptedDomain\MSFT_EXOAcceptedDomain.psm1'.
VERBOSE: Importing function 'Export-TargetResource'.
VERBOSE: Importing function 'Get-TargetResource'.
VERBOSE: Importing function 'Set-TargetResource'.
VERBOSE: Importing function 'Test-TargetResource'.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.22.202.1\DSCResources\MSFT_EXOActiveSyncDeviceAccessRule\MSFT_EXOActiveSyncDeviceAccessRule.psm1'.

Suggested solution to the issue

From a performance perspective, it would be great to only load modules, that are needed for the export.

The DSC configuration that is used to reproduce the issue (as detailed as possible)

# insert configuration here

The operating system the target node is running

OsName               : Microsoft Windows 10 Enterprise
OsOperatingSystemSKU : EnterpriseEdition
OsArchitecture       : 64-bit
WindowsVersion       : 2009
WindowsBuildLabEx    : 19041.1.amd64fre.vb_release.191206-1406
OsLanguage           : en-US
OsMuiLanguages       : {en-US, de-DE}

Version of the DSC module that was used ('dev' if using current dev branch)

@andikrueger andikrueger added Enhancement New feature or request Core Engine labels Feb 8, 2022
@andikrueger andikrueger changed the title Export-M365DSCConfigurationloads all DSCResources Export-M365DSCConfiguration loads all DSCResources Feb 8, 2022
@NikCharlebois
Copy link
Collaborator

Agreed that it would be great to be able to only do a selective load, but in this case we need to load each resource to analyze it's parameters and figure out if it is something we can export based on the parameters passed in by the user. This will no longer be required when everything is standardized on Microsoft Graph under the cover, but currently this is a requirement. The function Get-M365DSCComponentsForAuthenticationType is the culprit here. I'll park this issue for review at a later time once we have our authentication model standardized across all workloads.

@andikrueger
Copy link
Collaborator Author

As soon as there are components defined, the scope of the export is already set. Wouldn't it be sufficient to only load these selected components?

The issue about authentication could be solved by extending the modules.psd1 for example. We could add the supported authentication methods over there and validate those against the input parameters.

Is there something I'm missing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants