[Possible Bug] Set-AzureADMSGroup - 'MembershipRuleProcessingState' param not found
Error:
Set-EntraMSGroup : A parameter cannot be found that matches parameter name 'MembershipRuleProcessingState'. At line:16 char:71
- ... oupTypes $groupTypes.ToArray() -MembershipRuleProcessingState "On" -M
Script used/source: https://learn.microsoft.com/en-us/entra/identity/users/groups-change-type
Invoking the function: ConvertStaticGroupToDynamic "e76bfd30-48fb-4f40-83f1-8d94ddd4f8c2"
Script Details:
#The moniker for dynamic groups as used in the GroupTypes property of a group object
$dynamicGroupTypeString = "DynamicMembership"
function ConvertDynamicGroupToStatic
{
Param([string]$groupId)
#existing group types
[System.Collections.ArrayList]$groupTypes = (Get-AzureAdMsGroup -Id $groupId).GroupTypes
if($groupTypes -eq $null -or !$groupTypes.Contains($dynamicGroupTypeString))
{
throw "This group is already a static group. Aborting conversion.";
}
#remove the type for dynamic groups, but keep the other type values
$groupTypes.Remove($dynamicGroupTypeString)
#modify the group properties to make it a static group: i) change GroupTypes to remove the dynamic type, ii) pause execution of the current rule
Set-AzureAdMsGroup -Id $groupId -GroupTypes $groupTypes.ToArray() -MembershipRuleProcessingState "Paused"
}
function ConvertStaticGroupToDynamic
{
Param([string]$groupId, [string]$dynamicMembershipRule)
#existing group types
[System.Collections.ArrayList]$groupTypes = (Get-AzureAdMsGroup -Id $groupId).GroupTypes
if($groupTypes -ne $null -and $groupTypes.Contains($dynamicGroupTypeString))
{
throw "This group is already a dynamic group. Aborting conversion.";
}
#add the dynamic group type to existing types
$groupTypes.Add($dynamicGroupTypeString)
#modify the group properties to make it a static group: i) change GroupTypes to add the dynamic type, ii) start execution of the rule, iii) set the rule
Set-AzureAdMsGroup -Id $groupId -GroupTypes $groupTypes.ToArray() -MembershipRuleProcessingState "On" -MembershipRule $dynamicMembershipRule
}
Hi @SteveMutungi254, Upon checking the issue with Set-AzureADMSGroup, it appears that the error Set-EntraMSGroup : A parameter cannot be found that matches parameter name 'MembershipRuleProcessingState' is occurring because the MembershipRuleProcessingState parameter is not available in the GA 1.0 cmdlet. However, it is present in the Preview/Beta cmdlet Set-EntraBetaMSGroup.
@rtintor: Given that Set-AzureADMSGroup is a GA cmdlet, is there something we can do to ensure compatibility? Even though pointing to 'beta' resources is a bad design, but I am tempted to go with coverage as a higher goal by pointing GA cmdlet to beta backend. cc: @v-akarke
We need to ask the workload team to fix it instead of making a hack in our side.
-MembershipRuleProcessingState is now supported.