question

JonathanFallis avatar image
0 Votes"
JonathanFallis asked 96246324 commented

AzureAD Module - New-AzureADMSGroup issue?

Trying to use the cmdlet New-ADMSGroup (Module version v2.0.2.130) and this cmdlet isn't working.

My Code:

 *New-AzureADMSGroup -DisplayName "TestGroup" ` -Description "My Test Group " ` -MailEnabled $False ` -MailNickName "NotSet" ` -SecurityEnabled $True ` -GroupTypes "DynamicMembership" ` -membershipRule "(device.devicePhysicalIds -any _ -eq ""[OrderID]:Test"")" ` -MembershipRuleProcessingState "On"* 

Throws

 New-AzureADMSGroup : A parameter cannot be found that matches parameter name 'membershipRule'. At line:7 char:20 + -membershipRule "(device.devicePhysicalIds -any _ ... + ~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [New-AzureADMSGroup], ParameterBindingException + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.Open.MSGraphV10.PowerShell.NewMSGroup 

If I take out the membership rule param I get

 New-AzureADMSGroup : Error occurred while executing NewMSGroup Code: Request_BadRequest Message: A value is required for property 'membershipRule'. InnerError: RequestId: 53b2fe10-c047-4d6e-adbb-be8559503be0 DateTimeStamp: Wed, 24 Mar 2021 08:48:03 GMT HttpStatusCode: BadRequest HttpStatusDescription: Bad Request HttpResponseStatus: Completed At line:2 char:1 + New-AzureADMSGroup -DisplayName "TestGroup" ` + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [New-AzureADMSGroup], ApiException + FullyQualifiedErrorId : Microsoft.Open.MSGraphV10.Client.ApiException,Microsoft.Open.MSGraphV10.PowerShell.NewMSGroup 

Is this broken? Tried on a couple of tenants and a different laptop so problem is following the module, unless my code is wrong.

azure-active-directorywindows-server-powershell
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

vipulsparsh-MSFT avatar image
0 Votes"
vipulsparsh-MSFT answered 96246324 commented

@JonathanFallis Works perfectly fine for me.

81159-image.png

New-AzureADMSGroup -DisplayName "Dynamic Group 01" -Description "Dynamic group created from PS" -MailEnabled $False -MailNickName "group" -SecurityEnabled $True -GroupTypes "DynamicMembership" -MembershipRule "(user.department -contains ""Marketing"")" -MembershipRuleProcessingState "On"


I have a Azure AD preview module, when you type membership in command does it recognizes it as command when you hit tab and auto completes it to MembershipRule ?






image.png (49.4 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@vipulsparsh-MSFT Will the documentation ever be updated to reflect that this not available in the standard module? Alternatively, will this command ever be added to the standard module?

0 Votes 0 ·
JonathanFallis avatar image
0 Votes"
JonathanFallis answered vipulsparsh-MSFT commented

Here is the module I have:

 ModuleType Version    Name                                ExportedCommands
 ---------- -------    ----                                ----------------
 Binary     2.0.2.130  AzureAD                             {Add-AzureADApplicationOwner, Get-AzureADApplication, Get-...
 Binary     2.0.2.128  AzureAD                             {Add-AzureADApplicationOwner, Get-AzureADApplication, Get-...

And to answer your question, no, membership rule is not offered as a parameter.

81564-2021-03-25-14-39-59-window.png



So the module I have is not correct?


· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@JonathanFallis yes, please use the Azure AD preview module

0 Votes 0 ·
MartinRebecca-2443 avatar image
0 Votes"
MartinRebecca-2443 answered

I am having the exact same problem. So was someone else, 2 and a half years ago, and they said they would fix it immediately!

https://github.com/MicrosoftDocs/azure-docs/issues/34263

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.