SOLVED
Home

Creating dynamic groups Azure AD in powershell - MembershipRule Gives an error

%3CLINGO-SUB%20id%3D%22lingo-sub-436310%22%20slang%3D%22en-US%22%3ECreating%20dynamic%20groups%20Azure%20AD%20in%20powershell%20-%20MembershipRule%20Gives%20an%20error%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-436310%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20trying%20to%20create%20dynamic%20groups%20in%20azure%20AD%20trough%20powershell%2C%20i%20was%20going%20trough%20the%20mirosoft%20doc%20and%20found%20this%20command%3A%26nbsp%3B%3C%2FP%3E%3CDIV%3E%3CDIV%3E%3CEM%3ENew-AzureADMSGroup%20-DisplayName%20%22Dynamic%20Group%2001%22%20-Description%20%22Dynamic%20group%20created%20from%20PS%22%20-MailEnabled%20%24False%20-MailNickName%20%24False%20-SecurityEnabled%20%24True%20-GroupTypes%20%22DynamicMembership%22%20-MembershipRule%20%22(user.department%20-contains%20%22%22Marketing%22%22)%22%20-MembershipRuleProcessingState%20%22On%22%3C%2FEM%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3EThis%20command%20gives%20an%20error%20on%3CDIV%3E%3CDIV%3E%3CEM%3E-MembershipRule%26nbsp%3B%3C%2FEM%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CEM%3ENew-AzureADMSGroup%20%3A%20A%20parameter%20cannot%20be%20found%20that%20matches%20parameter%20name%20'MembershipRule'.%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3EAt%20C%3A%5CUsers%5CBjornM%5COneDrive%20-%20Netropolix%20NV%5CDocuments%5CProjects%5CAzureADBulkGroupCreation%5CAzureADBulkGroupCreation.ps1%3A40%20char%3A197%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3E%2B%20...%20Enabled%20%24True%20-GroupTypes%20%22DynamicMembership%22%20-MembershipRule%20%22(user.%20...%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3E%2B%20~~~~~~~~~~~~~~~%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3E%2B%20CategoryInfo%20%3A%20InvalidArgument%3A%20(%3A)%20%5BNew-AzureADMSGroup%5D%2C%20ParameterBindingException%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3E%2B%20FullyQualifiedErrorId%20%3A%20NamedParameterNotFound%2CMicrosoft.Open.MSGraphV10.PowerShell.NewMSGroup%3C%2FEM%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3EI%20cannot%20seem%20to%20find%20what%20is%20the%20issue%2C%20anybody%20had%20the%20same%20issue%3F%20I%20updated%20my%20azure%20ad%20module%20to%20the%20latest%20version.%20but%20still%20gives%20the%20eroor%20on%20the%20parameter.%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3EThanks%3C%2FDIV%3E%3CDIV%3EBjorn%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-436310%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20AD%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EGroups%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPowerShell%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-439031%22%20slang%3D%22en-US%22%3ERe%3A%20Creating%20dynamic%20groups%20Azure%20AD%20in%20powershell%20-%20MembershipRule%20Gives%20an%20error%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-439031%22%20slang%3D%22en-US%22%3E%3CP%3EI%20guess%20you%20missed%20the%20part%20where%20you%20need%20the%20Azure%20AD%20PREVIEW%20module%20for%20this%3F%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fwww.powershellgallery.com%2Fpackages%2FAzureADPreview%2F2.0.2.17%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.powershellgallery.com%2Fpackages%2FAzureADPreview%2F2.0.2.17%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
bjornmertens
Occasional Contributor

Hi,

 

I am trying to create dynamic groups in azure AD trough powershell, i was going trough the mirosoft doc and found this command: 

New-AzureADMSGroup -DisplayName "Dynamic Group 01" -Description "Dynamic group created from PS" -MailEnabled $False -MailNickName $False -SecurityEnabled $True -GroupTypes "DynamicMembership" -MembershipRule "(user.department -contains ""Marketing"")" -MembershipRuleProcessingState "On"
 
This command gives an error on
-MembershipRule  
 
New-AzureADMSGroup : A parameter cannot be found that matches parameter name 'MembershipRule'.
At C:\Users\BjornM\OneDrive - Netropolix NV\Documents\Projects\AzureADBulkGroupCreation\AzureADBulkGroupCreation.ps1:40 char:197
+ ... Enabled $True -GroupTypes "DynamicMembership" -MembershipRule "(user. ...
+ ~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [New-AzureADMSGroup], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.Open.MSGraphV10.PowerShell.NewMSGroup
 
I cannot seem to find what is the issue, anybody had the same issue? I updated my azure ad module to the latest version. but still gives the eroor on the parameter. 
 
Thanks
Bjorn
1 Reply
Solution

I guess you missed the part where you need the Azure AD PREVIEW module for this? https://www.powershellgallery.com/packages/AzureADPreview/2.0.2.17

Related Conversations
Extentions Synchronization
Deleted in Discussions on
3 Replies
Tabs and Dark Mode
cjc2112 in Discussions on
38 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
29 Replies