How to solve the issue of guest users access in Office 365 when you applied restriction on office 365 groups creation tenant wide?
- connect-AzureAD via powerShell
- Run the following command:
- $template = Get-AzureADDirectorySettingTemplate | ? {$_.displayname -eq "group.unified"}
- See if you already have an AzureADDirectorySetting object, and if so save the Object ID. Run this command:
- $settingsObjectID = (Get-AzureADDirectorySetting | Where-object -Property Displayname -Value "Group.Unified" -EQ).id
- $template = Get-AzureADDirectorySettingTemplate | ? {$_.displayname -eq "group.unified"}
- $settingsCopy = $template.CreateDirectorySetting()
- New-AzureADDirectorySetting -DirectorySetting $settingsCopy
- $settingsObjectID = (Get-AzureADDirectorySetting | Where-object -Property Displayname -Value "Group.Unified" -EQ).id
- Copy the AzureADDirectorySetting object back into the local $settingsCopy variable:
- $settingsCopy = Get-AzureADDirectorySetting –Id $settingsObjectID
- This is only a COPY of the settings; changes won’t take effect until you copy it BACK to the AzureADDirectorySetting object.
- Set the option to allow | block (True or False) guests to access O365 groups:
- $settingsCopy["AllowGuestsToAccessGroups"] = "true"
To verify the change took effect, retrieve the value from the AzureADDirectorySetting object (don’t just look at the local copy in $settingsCopy):
- (Get-AzureADDirectorySetting –Id $settingsObjectID).Values