Home > Enterprise >  New dynamic group AzureAD powershell
New dynamic group AzureAD powershell

Time:09-27

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.

enter image description here

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

enter image description here

After installed AzureADPreview, I runned your commands and got an output Successfully.

enter image description here

Portal: enter image description here

Reference: New-AzureADMSGroup (AzureADPreview) | Microsoft Learn

  • Related