I have a problem with this cmdlet: New-AzureADMSGroup. When I try to run the next error message come up:
"New-AzureADMSGroup : A parameter cannot be found that matches parameter name ‘MembershipRule’.
At line:1 char:216
- … XXXXXXXX" -GroupTypes “DynamicMembership” -MembershipRule "(user. …
-
- CategoryInfo : InvalidArgument: ( [New-AzureADMSGroup], ParameterBindingException
- FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.Open.MSGraphV10.PowerShell.NewMSGroup"
I’m not frequently using this cmdlet, and I know this is a Public Preview so not a stable version. Do you know anything about this problem? Maybe am I misspell something that I can’t see? Or, is the cmdlet changed?
Thank you for any help
No code was posted, so it is difficult to tell. Based on the documentation, there is a MembershipRule parameter, the first thought is that it could be in a parameterset depending on the other parameters that were passed to the cmdlet.
I have tried it with a test group according to its doc page:
New-AzureADMSGroup -DisplayName “TestGroup1” -Description “Test group for powershell.org” -MailEnabled $False -MailNickname “test” -SecurityEnabled $True -GroupTypes “DynamicMembership” -MembershipRule “(user.objectId -ne null)” -MembershipRuleProcessingState “On”
the error message was:
New-AzureADMSGroup : A parameter cannot be found that matches parameter name ‘MembershipRule’.
At line:1 char:187
- … Enabled $True -GroupTypes “DynamicMembership” -MembershipRule "(user. …
-
- CategoryInfo : InvalidArgument: ( [New-AzureADMSGroup], ParameterBindingException
- FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.Open.MSGraphV10.PowerShell.NewMSGroup
the user.objectId -ne null is working if I write it directly to the Azure portal and even if I change it to something else it doesn’t work.
I have tried it with a test group according to its doc page:
New-AzureADMSGroup -DisplayName “TestGroup1” -Description “Test group for powershell.org” -MailEnabled $False -MailNickname “test” -SecurityEnabled $True -GroupTypes “DynamicMembership” -MembershipRule “(user.objectId -ne null)” -MembershipRuleProcessingState “On”
the error message was:
New-AzureADMSGroup : A parameter cannot be found that matches parameter name ‘MembershipRule’.
At line:1 char:187
- … Enabled $True -GroupTypes “DynamicMembership” -MembershipRule "(user. …
-
- CategoryInfo : InvalidArgument: ( [New-AzureADMSGroup], ParameterBindingException
- FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.Open.MSGraphV10.PowerShell.NewMSGroup
the user.objectId -ne null is working if I write it directly to the Azure portal and even if I change it to something else it doesn’t work.
If you run Get-Command New-AzureADMSGroup | Select Module* , do you see the correct module listed?