dsccommunity / SharePointDsc

The SharePointDsc PowerShell module provides DSC resources that can be used to deploy and manage a SharePoint farm
MIT License
245 stars 107 forks source link

[SPWebAppPeoplePickerSettings] SearchActiveDirectoryDomains - CustomFilter #1393

Closed ChristophHannappel closed 2 years ago

ChristophHannappel commented 2 years ago

The Ressource SPWebAppPeoplePickerSettings does not support the following Properties for SearchActiveDirectoryDomains

The Parameters of MSFT_SPWebAppPPSearchDomain should be extended by: Parameter Attribute DataType Description Allowed Values
CustomFilter Write String Sets a customized query filter to send to Active Directory
ShortDomainName Write String NetBIOS name of the domain or forest

I'd like to create a pull request with the needed changes.

I've checked the current code and the Set function only seems to add a SPPeoplePickerSearchActiveDirectoryDomain if it can not find one with the given DomainName and IsForest Property. As far as i can see the current implementation would not change the AccessAccount Property of an existing SPPeoplePickerSearchActiveDirectoryDomain. Currently the existing code would only apply a change, if the required parameters FQDN and IsForest change, but not the optional ones.

Since i'd also need that for the other optional parameters - is there another ressource which is a good code example?

ykuijs commented 2 years ago

Hi @ChristophHannappel, after looking at the code I believe you are right: It is only creating new AD domain connections and not updating existing ones. It would be great if you could update this resource to add the two new parameters and maybe also update the resource if it isn't configured correctly.

ykuijs commented 2 years ago

I would add an Else statement here in which I check all properties if they are correct and update then if not: https://github.com/dsccommunity/SharePointDsc/blob/fe2111d3c911e2b5ddd7f14855f1a17c32ff0047/SharePointDsc/DSCResources/MSFT_SPWebAppPeoplePickerSettings/MSFT_SPWebAppPeoplePickerSettings.psm1#L216