# (L2) Ensure external domains are restricted in the Teams admin center

Federation lets users in other Microsoft 365 and Teams organizations find and message people in your tenant.

Source: https://maester.dev/docs/tests/CIS.M365.8.2.1

<!-- This file is generated by website/scripts/generate-test-docs.mjs. Do not edit manually. -->

<div class="test-byline"><div class="test-byline-avatars"><a class="test-byline-avatar test-byline-avatar--author" href="/contributors/jeremyfinney-lgtm" title="jeremy finney · Original author"><img src="https://github.com/JeremyFinney-lgtm.png" alt="jeremy finney" width="28" height="28" loading="lazy" decoding="async" /></a></div><div class="test-byline-meta"><span class="test-byline-text">Contributed by <a href="/contributors/jeremyfinney-lgtm">jeremy finney</a></span><a class="test-byline-link" href="/contributors">All contributors →</a></div></div>

<p class="test-part">Part of <a href="/docs/tests/cis">CIS</a> · Teams · External access · <a href="/docs/tests">All checks</a></p>

```powershell title="Run this check"
Invoke-Maester -TestId CIS.M365.8.2.1
```

## Overview

Federation lets users in other Microsoft 365 and Teams organizations find and message people in your tenant. If every known external domain is allowed, anyone with a tenant in those domains can start chats with your users. That is a common route for phishing and social engineering, because the sender looks like a normal business contact.

Restricting external domains means only the partner domains you choose can communicate with your users. Turning federation off removes the path completely.

#### Remediation action

1. Sign in to the [Microsoft Teams admin center](https://admin.teams.microsoft.com).
2. Go to **Users** > **External access**.
3. Next to **Teams and Skype for Business users in external organizations**, choose **Allow only specific external domains**, select **Add external domains** and add the approved domains. To turn external access off instead, choose **Block all external domains**.
4. Select **Save**.

##### PowerShell

1. Connect to Teams PowerShell using `Connect-MicrosoftTeams`.
2. Run the following commands to allow only specific domains, replacing the example domain with your approved domains. The list replaces the domains that are allowed now:

```powershell
$domains = [System.Collections.Generic.List[string]]::new()
$domains.Add('partner.example.com')
Set-CsTenantFederationConfiguration -AllowFederatedUsers $true -AllowedDomainsAsAList $domains
```

>Note: Setting AllowFederatedUsers to $false also meets the recommended state.

#### Related links

* [Microsoft Teams admin center](https://admin.teams.microsoft.com)
* [Manage external meetings and chat with people and organizations](https://learn.microsoft.com/microsoftteams/manage-external-access)
* [Set-CsTenantFederationConfiguration](https://learn.microsoft.com/powershell/module/teams/set-cstenantfederationconfiguration)
* [CIS Microsoft 365 Foundations Benchmark v7.0.0 - 8.2.1](https://www.cisecurity.org/benchmark/microsoft_365)

## Details

<details>
<summary>Every attribute of this check</summary>

| Field | Value |
| --- | --- |
| Test ID | CIS.M365.8.2.1 |
| Severity | Medium |
| Suite | CIS |
| Product | Teams |
| Feature | External access |
| Area | External access and sharing |
| Resource type | Tenant |
| User impact | Medium |
| Implementation cost | Low |
| MITRE ATT&CK | T1566 Phishing |
| Supports benchmark | CIS Microsoft 365 Foundations Benchmark (version 7.0.0), requirement 8.2.1 |
| Benchmark level | L2 |
| Benchmark profiles | E3 Level 2 |
| Supports controls | cis-m365:8.2.1, nist-800-53-r5:AC-20 |
| PowerShell test | [Test-MtCisTeamsExternalDomainsRestricted](https://github.com/maester365/maester/blob/main/tests/cis/Test.CIS.M365.8.2.1.ps1) |
| Services | Teams |

</details>

## Source

- Test: [`tests/cis/Test.CIS.M365.8.2.1.ps1`](https://github.com/maester365/maester/blob/main/tests/cis/Test.CIS.M365.8.2.1.ps1)
- Documentation: [`tests/cis/Test.CIS.M365.8.2.1.md`](https://github.com/maester365/maester/blob/main/tests/cis/Test.CIS.M365.8.2.1.md)
