powershell icon indicating copy to clipboard operation
powershell copied to clipboard

[FEATURE] Set-PnPMicrosoft365Group Restrict Adding Guests

Open YuriySamorodov opened this issue 3 years ago • 0 comments

Is your feature request related to a problem? Please describe. Not related to any issue

Describe the solution you'd like It would be great to be able changing group membership restriction settings with Set-PnPMicrosoft365Group Something like: Set-PnPMicrosoft365Group -AllowGuests $true

Describe alternatives you've considered Right now the only option Microsoft provides is using AzureADPreview module:

$GroupName = "<GroupName>"
Connect-AzureAD
$template = Get-AzureADDirectorySettingTemplate | ? {$_.displayname -eq "group.unified.guest"}
$settingsCopy = $template.CreateDirectorySetting()
$settingsCopy["AllowToAddGuests"]=$False
$groupID= (Get-AzureADGroup -SearchString $GroupName).ObjectId
New-AzureADObjectSetting -TargetType Groups -TargetObjectId $groupID -DirectorySetting $settingsCopy

Additional context https://docs.microsoft.com/en-us/microsoft-365/solutions/per-group-guest-access?view=o365-worldwide

YuriySamorodov avatar Aug 13 '21 20:08 YuriySamorodov