我正在尝试在统一组级别上控制团队的来宾访问。
我尝试关注本文,但似乎有些变量(例如$SettingID
)没有值:
import-module azureadpreview
connect-azuread
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session -DisableNameChecking
$GroupID = get-unifiedgroup -Identity <smtpaddress> | Select-Object -ExpandProperty ExternalDirectoryObjectId
$SettingID = Get-AzureADObjectSetting -TargetType Groups -TargetObjectID $GroupID | select-object -expandproperty ID
remove-azureadobjectsetting -id $settingid -targettype Groups -TargetObjectID $GroupID
$template = Get-AzureADDirectorySettingTemplate | ? {$_.displayname -eq "group.unified.guest"}
$settingsCopy = $template.CreateDirectorySetting()
$settingsCopy["AllowToAddGuests"]=$False
New-AzureADObjectSetting -TargetType Groups -TargetObjectId $groupID -DirectorySetting $settingsCopy
从我看到的情况来看,该脚本从$settingsid
行开始失败。这个变量给我一个Null值的结果。
答案 0 :(得分:0)
问题出在AzureAD模块上,该设置仅在AzureADPreview上可用。