microsoft/Microsoft365DSC

ENHANCEMENT / FEATURE REQUEST - Filter on Property

Raimer1988 opened this issue · 3 comments

Description of the issue

Is there a way to filter out unwanted properties from the resources instead of filtering the actual resources?

For instance, If I'm running the following export:
Export-M365DSCConfiguration -Components @("AADApplication") -ApplicationId $ApplicationId -CertificateThumbprint $CertificateThumbprint -TenantId $TenantId

I get all the Entra ID applications and all of their properties.
Is it possible to get all the applications, but only subset of the properties (e.g. "AppId", "DisplayName" and "Permissions")?

As far as I understand, the "-Filter" parameter only filters out unwanted resources, not unwanted properties.
I'm looking for something that behaves more like "Select-Object" rather than "Where-Object".

Sorry if this post doesn't follow the proper guidelines. This is my first post on GitHub.

Love the Microsoft365DSC project!

Microsoft 365 DSC Version

1.24.424.1

Which workloads are affected

Azure Active Directory (Entra ID), Exchange Online, Intune, Office 365 Admin, OneDrive for Business, Planner, Power Platform, Security & Compliance Center, SharePoint Online, Teams

The DSC configuration

No response

Verbose logs showing the problem

No response

Environment Information + PowerShell Version

No response

The purpose of Desired State Configuration is to represent an object in its entirety to make sure that the object corresponds to the one we want to have. If that object is missing, we need enough information to recreate the object again, thus making it a requirement to export all information.

Unfortunately Microsoft365DSC doesn't support what you want directly, but you could export a configuration and "manually" parse the information with ConvertTo-DSCObject, which returns a list of all resources with its properties. There you could then filter out all the properties you need. That's a bit more of a dirty workaround, but it probably works for your case.

As @FabienTschanz points out, there is no such option available in M365DSC as we want to have all available information of a resource within the exports.

Could you describe your use-case a bit more?

As @FabienTschanz points out, there is no such option available in M365DSC as we want to have all available information of a resource within the exports.

Could you describe your use-case a bit more?

Thank you for your replies @FabienTschanz and @andikrueger .

Our specific use-case is investigating possibilities for scaling the Microsoft365DSC solution.
For instance, we have a tenant with apx. 13.000 O365 groups (and corresponding SharePoint sites) and exporting the data for this amount of groups/sites takes a very long time, which impacts the possibilities for enforcing the settings we might want.

In this scenario I was thinking that we might not necessarily care about each setting ("SocialBarOnSitePagesDisabled"), for each SharePoint site, but only a few select settings ("OverrideTenantAnonymousLinkExpirationPolicy").
If we were able to export only the settings we want, pr. resource type, then we might be able to decrease the time it takes to make such an export.

As FabienTschanz said, we could edit the exported file after the fact, for enforcement. However this will not help when we will want to generate a delta report, later.

It seems as though this specific use is not supported however and that's fine. I was just trying to look into what our possibilities were.