This article provides a solution to the query raised by a user regarding the possibility of making exceptions to enforced policies for Teams, particularly concerning guest access which has been restricted by default as per department templates.
The user, Dario Nujic, inquired whether there was a method to exclude or modify an enforced policy for a specific Team that, by default, does not allow guest access due to departmental templates set within the organization.
Install-Module AzureADPreview
."<GroupName>"
with the actual name of the group.The script provided performs the following actions:
The main PowerShell script example is as follows:
$GroupName = "<GroupName>"
Connect-AzureAD
$template = Get-AzureADDirectorySettingTemplate | ? {$_.displayname -eq "group.unified.guest"}
$settingsCopy = $template.CreateDirectorySetting()
$settingsCopy["AllowToAddGuests"]=$True
$groupID= (Get-AzureADGroup -SearchString $GroupName).ObjectId
New-AzureADObjectSetting -TargetType Groups -TargetObjectId $groupID -DirectorySetting $settingsCopy
To verify the success of the script's execution:
Get-AzureADObjectSetting -TargetObjectId $groupID -TargetType Groups | fl Values
The Solutions2Share blog contains further details on blocking guest access for specific Teams in Microsoft Teams.
Adjusting policies for Teams requires executing specific PowerShell scripts as provided by the Solutions2Share Support Team. For any issues during the process or additional questions, users are encouraged to reach out to the support team.
Users in need of assistance or experiencing similar issues should contact Solutions2Share Support. We are committed to offering guidance and support to navigate through policy adjustments and customizations.
Remember to provide feedback on the effectiveness of the solution. Your cooperation is crucial for us to improve service quality and performance.