-
Notifications
You must be signed in to change notification settings - Fork 534
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
AADAdministrativeUnit - fixes #4437 #4462
AADAdministrativeUnit - fixes #4437 #4462
Conversation
Modules/Microsoft365DSC/DSCResources/MSFT_AADAdministrativeUnit/MSFT_AADAdministrativeUnit.psm1
Show resolved
Hide resolved
The following lines (original 105..115) have been removed:
The issue is that "Get-MgBetaDirectoryAdministrativeUnit -AdministrativeId $Id -ErrorAction Stop" will throw an exception if the AU doesn't exist. This exception translates into the AU is reported as not being found which in turn results in a new AU being created regardless of existence of an AU with the same DisplayName. |
@salbeck-sit You need to call the cmdlets with ErrorAction = SilentlyContinue so it doesn't bounce into the catch section, please check the example below from L1044..L1067. |
That is exactly what is left after the 'offending' lines were removed. It seems that this was added in an effort to optimize performance but the older code-block wasn't removed. It is now. The current code now contains the following:
Note that -EA Stop doesn't throw when -Filter is used and a resource isn't found. |
Pull Request (PR) description
Update AADAdministrativeUnit to handle omitted Ensure and/or Id in config
This Pull Request (PR) fixes the following issues
Fixes #4437