创建具有组类型的Azure AD组,“统一”并“动态成员” Azure Powershell功能失败
我正在使用 Moudule,在此帮助的帮助下,我试图创建一个类型的“统一”和“ DynamicMembership”类型的组。
因此,根据Microsoft Doc,这是我使用过的命令
Import-Module AzureADPreview -UseWindowsPowerShell
$tenantId = <my tenant id>
$clientId = <my client id>
$thumbprint = <my thumbprint>
Connect-AzureAD -TenantId $tenantId -ApplicationId $clientId -CertificateThumbprint $thumbprint
New-AzureADMSGroup -Description $description -DisplayName `
$displayName -MailEnabled $true -SecurityEnabled $true `
-MailNickname $nickName -GroupTypes "DynamicMembership", "Unified"
-MembershipRule '(user.department -contains "tech")' -MembershipRuleProcessingState $true
,但是我在Groptypes错误中始终获得无效的值。
在一种非常不同的方法中,我尝试首先使用统一类型创建组,然后重新查询同一组,并将Groutype添加到“ DynamicMembership”中,我希望它能起作用,但这也不是不起作用的t有任何区别。
就像这样 -
New-AzureADMSGroup -Description $description -DisplayName `
$displayName -MailEnabled $true -SecurityEnabled $true `
-MailNickname $nickName -GroupTypes "Unified"
$grp = Get-AzureADMSGroup -SearchString $displayName
if($grp -ne $null)
{
[System.Collections.ArrayList]$groupTypes = $grp.GroupTypes
$groupTypes.Add($dynamicGroupTypes)
Set-AzureAdMsGroup -Id $grp.Id `
-GroupTypes $dynamicGroupTypes `
-MembershipRuleProcessingState "On" `
-MembershipRule $memberShipRule
}
您能告诉我我做错了什么,这在Windows PowerShell中工作正常。我无法理解有关该杂种的畸形。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
•您正在使用Azure函数中使用PowerShell命令来创建“统一”和“动态”组的命令中的一些
基本错误
。 Azure函数中的命令执行涉及仅使用'azureadpreview'模块。因此,您将必须从安装在PowerShell中的模块列表中卸载并删除“ Azuread” 模块。为此,请先执行以下命令: -完成后,
像您在所述命令中所做的那样,安装AzureadPreview Module
。然后,像您一样执行'Connect-azuread'命令。然后,按照我从头到尾执行我的执行,执行我在下面所述执行的命令。请不要忘记声明您在问题描述中所做的其他变量,'client ID','tenant id'和'thumbprint': -一旦按原样执行上述命令,命令将在Azure函数中成功执行,而不会出现任何错误或问题。
• You are making some
basic mistakes
in the command that you are using for creating a ‘Unified’ and ‘Dynamic’ group through using powershell command in the Azure function. The command execution in Azure function involves the use of ‘AzureADPreview’ module only. Thus, you will have to uninstall and remove the ‘AzureAD’ module from your list of modules installed in powershell. For this purpose, execute the below command first: -Once done, then
install the AzureADPreview module
as you have done in your stated command. Then, execute the ‘Connect-AzureAD’ command as you have done. Then, execute the command as stated by me below for errorless execution as it is from start to end. Please do not forget to declare the other variables that you did in your question description for ‘Client ID’, ‘Tenant ID’ and ‘Thumbprint’: -Once the above command is executed as it is, your command will be executed successfully in Azure function without any error or issue.