Last active
March 14, 2022 14:04
-
-
Save NielsS79/4f200359540ec4fe930d675112475865 to your computer and use it in GitHub Desktop.
Find an Azure AD (Dynamic) group by a keyword in its membership query.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
This oneliner will fetch all Azure AD Dynamic Membership groups, matching a keyword to its membership query. | |
.DESCRIPTION | |
Get-AzureADMSGroup is basically Get-AzureADGroup via Graph API. It's more flexible but also a little tricky. | |
Using the -Filter below we only fetch groups where the GroupTypes property (collection) contains a 'DynamicMembership' value. | |
Unfortunately the contains() filter operator isn't implemented (there is startsWith() though) so we need to iterate over all results to find $SearchString matches. | |
.NOTES | |
Author: Niels Scheffers <niels.scheffers@etesian.nl> | |
Last modified: 2022-03-10 | |
#> | |
Get-AzureADMSGroup -Filter "GroupTypes/any(s:s eq 'DynamicMembership')" | Where-Object -Property DisplayName -Like '*keyword*'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment