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

Ignore certain properties in Assert-M365DSCBlueprint #2444

Closed
cstaubli opened this issue Oct 26, 2022 · 2 comments · Fixed by #2652 or #2667
Closed

Ignore certain properties in Assert-M365DSCBlueprint #2444

cstaubli opened this issue Oct 26, 2022 · 2 comments · Fixed by #2652 or #2667
Labels
Core Engine Enhancement New feature or request

Comments

@cstaubli
Copy link

We're using Assert-M365DSCBlueprint to assert and monitor configuration drift for a number of tenants. Therefore we created a blueprint which is not specific for one tenant, but contains settings which we would assert on many tenants. For example, we assert the following named location must be present:

AADNamedLocationPolicy 'Trusted Countries for Administrative Access' {
    CountriesAndRegions               = @("CH");
    Credential                        = $Credscredential;
    DisplayName                       = "Trusted Countries for Administrative Access";
    Ensure                            = "Present";
    IncludeUnknownCountriesAndRegions = $False;
    OdataType                         = "#microsoft.graph.countryNamedLocation";
    Managedidentity                   = $False;
    Id                                = "";
}

The problem is the property 'Id' will differ in every tenant. I've tried '*' and '%' as wildcard to accept any value, and even exclude this property, but still every time this is reported as configuration drift.

I've noted here that some properties are excluded from reporting, is there a way to exclude others as well (apart from a fork and adjust this line)?

This happens with other resources as well, it is not specific to AADNamedLocationPolicy. I know one obvious solution would be having a blueprint for each tenant with correct Id, but with many tenants this is a cumbersome task.

Thanks in advance
Christian

@andikrueger andikrueger added Enhancement New feature or request Core Engine labels Oct 26, 2022
@andikrueger
Copy link
Collaborator

The current exclusion helps to disable noise in the reports. It will exclude resource names like AADNamedLocation or the authentication parameters.

In your case:

the ID is part of the resource and the configuration. Any change to the ID would be reported as a drift. Even no configuration is a drift, as this would be a different configuration from the one with the id.

I totally agree on this being not optimal. Is it always the parameter ID causing issues or are there other parameters as well?

maybe we could add a new Parameter to all reporting functions: -ExcludeParameter @(“ID”)

if this array is set, the exclusion list would be extended with the string array provided.

@cstaubli
Copy link
Author

cstaubli commented Nov 2, 2022

Yeah, that would be perfect having an exclude parameter. Most of the time it is ID, but could be others as well. This would really help us build generic blueprints and report configuration drifts for many tenants based on this blueprint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core Engine Enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants