I am trying to make a dynamic group in AzureADMS, but I get the error message "A parameter cannot be found that matches parameter name 'MembershipRule'." This is my command:
New-AzureADMSGroup `
-DisplayName "IT"`
-Description "IT-department" `
-MailEnabled $False `
-SecurityEnabled $True `
-MailNickName "IT" `
-GroupTypes "DynamicMembership" `
-MembershipRule "user.department -eq "IT"" `
-MembershipRuleProcessingState "On"
Could you please help?
Other inputs are also welcome.
CodePudding user response:
I tried to reproduced in my environment and got similar error.
The error occurs as you may have had incorrect module AzureAD. So I uninstall Azure AD module and install AzureADPreview by running this command
Uninstall-module AzureAD
Instead of Azure AD used AzureADPreview
Install-module AzureADPreview
After installed AzureADPreview, I runned your commands and got an output Successfully.
Portal:
Reference: New-AzureADMSGroup (AzureADPreview) | Microsoft Learn