All scripts
Governance 301

Get-TeamsExternalAccessReport

Reports tenant level external access and guest access settings for Teams, plus any domain specific allow or block entries, to confirm federation is actually configured the way you think it is.

Get-TeamsExternalAccessReport.ps1
<#
.SYNOPSIS
    Reports Teams external access and federation configuration.

.DESCRIPTION
    Checks tenant level external access settings, whether federation is
    open or restricted, and lists any domain specific allow or block
    entries, so the actual federation posture is confirmed rather than
    assumed.

.EXAMPLE
    .\Get-TeamsExternalAccessReport.ps1

.NOTES
    Requires the MicrosoftTeams module and an active Connect-MicrosoftTeams session.

.AUTHOR
    Shehryar Hassan
#>

$config = Get-CsTenantFederationConfiguration

[pscustomobject]@{
    AllowFederatedUsers      = $config.AllowFederatedUsers
    AllowPublicUsers         = $config.AllowPublicUsers
    AllowTeamsConsumer       = $config.AllowTeamsConsumer
    BlockedDomainCount       = $config.BlockedDomains.Count
    AllowedDomainsRestricted = $config.AllowedDomains.AllowedDomain.Count -gt 0
} | Format-List

if ($config.BlockedDomains.Count -gt 0) {
    Write-Host "Blocked domains:" -ForegroundColor Yellow
    $config.BlockedDomains | Format-Table -AutoSize
}

Read it before you run it, and test in a safe tenant first.