0

我想使用 Powershell 使用 MicrosoftTeams 和 AzureADPreview 模块在 Microsoft Teams 中创建一个具有动态成员资格的新团队

我可以使用命令创建一个新团队

New-Team -DisplayName "NewTeam" -Description "New Team" -MailNickName "NewTeam" -Visibility "Private"

当我尝试使用命令将组类型设置为 Dynamic Memberehip 时,

Set-AzureADMSGroup -Id "xxx" -GroupTypes "DynamicMembership" -MembershipRuleProcessingState "On" -MembershipRule "user.mailNickname -eq ""yyy"""

我收到以下错误消息:

Set-AzureADMSGroup : Error occurred while executing SetMSGroup
Code: Request_BadRequest
Message: One or more properties contains invalid values.
InnerError:
  RequestId: e82c8ab7-c0a1-4631-b983-fc5cb2b0e860
  DateTimeStamp: Mon, 06 Jul 2020 12:13:37 GMT
HttpStatusCode: BadRequest
HttpStatusDescription: Bad Request
HttpResponseStatus: Completed
At line:1 char:1
+ Set-AzureADMSGroup -ID "db9e3933-1883-4d3a-88fe-f95d29b5d8c6" -Securi ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Set-AzureADMSGroup], ApiException
    + FullyQualifiedErrorId : Microsoft.Open.MSGraphBeta.Client.ApiException,Microsoft.Open.MSGraphBeta.PowerShell.SetMSGroup
4

2 回答 2

0

请尝试以下 cmdlet 来设置组属性并查看它是否有效

Set-AzureADMSGroup -Id "xxx" -GroupTypes "DynamicMembership" -MembershipRule "(user.mailNickname -eq ""yyy"")" -MembershipRuleProcessingState "On" 

谢谢,马努

于 2020-07-06T16:29:10.720 回答
0

有完全相同的问题,并且很难解决这个问题,因为 MS Docs 只是一个废话。所以,罪魁祸首根本不是会员规则,这个很好,尽管一切都指向它的方向。但实际上,这一切都与 MS Docs 中似乎错误的“GroupType”有关。

所以这是将统一静态组转换为动态组的正确命令:

Set-AzureAdMsGroup -ID xxxx -GroupTypes @("DynamicMembership", "Unified") -MembershipRuleProcessingState "On" -MembershipRule "(user.mailNickname -eq ""yyyy"")"
于 2020-07-31T14:05:49.457 回答