IT Blog

Identity & Access Management

How to solve the issue of guest users access in Office 365 when you applied restriction on office 365 groups creation tenant wide?

How to solve the issue of guest users access in Office 365 when you applied  restriction on office 365 groups creation tenant wide?

  1. Connect-AzureAD via powerShell
  2. Run the following command:
  3. $template = Get-AzureADDirectorySettingTemplate | ? {$_.displayname -eq “group.unified”}
  4. See if you already have an AzureADDirectorySetting object, and if so save the Object ID. Run this command:
  5. $settingsObjectID = (Get-AzureADDirectorySetting | Where-object -Property Displayname -Value “Group.Unified” -EQ).id
  6. $template = Get-AzureADDirectorySettingTemplate | ? {$_.displayname -eq “group.unified”}
  7. $settingsCopy = $template.CreateDirectorySetting()
  8. New-AzureADDirectorySetting -DirectorySetting $settingsCopy
  9. $settingsObjectID = (Get-AzureADDirectorySetting | Where-object -Property Displayname -Value “Group.Unified” -EQ).id
  10. Copy the AzureADDirectorySetting object back into the local $settingsCopy variable:
  11. $settingsCopy = Get-AzureADDirectorySetting –Id $settingsObjectID
  12. This is only a COPY of the settings; changes won’t take effect until you copy it BACK to the AzureADDirectorySetting object.
  13. Set the option to allow | block (True or False) guests to access O365 groups:
  14. $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):

  1. (Get-AzureADDirectorySetting –Id $settingsObjectID).Values

Leave a Reply

Your email address will not be published. Required fields are marked *