如何配置Windows Defender防火墙规则及应用控制,使Microsoft Teams在Windows 10受限环境下正常运行?
Let's break this down into two clear parts: getting Teams working with Windows Defender's restricted app allowlist, and setting up the firewall rules to keep it running smoothly.
Your current rules aren't taking effect because Teams relies on more than just Teams.exe and Update.exe to operate, and relative paths can cause resolution issues. Here's the step-by-step fix:
Use Environment Variables or Full Paths
Ditch the relative pathAppData\Local\Microsoft\Teams\current\Teams.exe—instead use the flexible environment variable%LOCALAPPDATA%\Microsoft\Teams\current\Teams.exeor the full expanded path likeC:\Users\<YourUsername>\AppData\Local\Microsoft\Teams\current\Teams.exe. This ensures the system always finds the correct executable.Add All Required Teams Processes to the Allow List
Teams needs these additional executables to function properly:%LOCALAPPDATA%\Microsoft\Teams\current\Electron.exe(Electron framework host for core app functionality)%LOCALAPPDATA%\Microsoft\Teams\current\resources\app.asar.unpacked\modules\desktop-native\TeamsHost.exe(Handles calls, screen sharing, and native integrations)%LOCALAPPDATA%\Microsoft\Teams\Update.exe(Critical for auto-updates and background maintenance)
Use Publisher Rules for Auto-Update Compatibility
Teams updates frequently, which can change thecurrentfolder to a version-specific directory—breaking path-based rules. Publisher rules (based on digital signatures) are far more reliable:- Run
gpedit.mscto open the Local Group Policy Editor - Navigate to Computer Configuration > Windows Settings > Security Settings > Application Control Policies > AppLocker > Executable Rules
- Right-click "Executable Rules" > "Create New Rule"
- Skip the welcome screen, select "Allow", and choose "All Users" (or specific user groups)
- Select "Publisher" as the rule condition, click "Browse" and select
Teams.exefrom its install path - Set the publisher to
Microsoft Corporation, product name toMicrosoft Teams, and check "Use wildcard" for the version field to cover all future updates - Repeat this for
Update.exe—any signed Teams executable will now be allowed, even after updates.
- Run
Enable the Application Identity Service
AppLocker depends on this service to enforce rules:- Press Win + R, type
services.msc, and hit Enter - Locate "Application Identity", set its startup type to "Automatic", then start the service. Restart your PC if changes don't take effect immediately.
- Press Win + R, type
Teams needs both inbound and outbound firewall access to handle messages, calls, updates, and screen sharing. Here's how to set it up:
Open Advanced Firewall Settings
Search for "Windows Defender Firewall" in the Start menu, then click "Advanced settings" on the left sidebar.Create Outbound Rules (For Internet Access)
Outbound rules let Teams connect to Microsoft's servers:- Right-click "Outbound Rules" > "New Rule"
- Select "Program" > Next
- Click "Browse" and select
%LOCALAPPDATA%\Microsoft\Teams\current\Teams.exe> Next - Choose "Allow the connection" > Next
- Check all network types (Domain, Private, Public) unless you have specific security restrictions > Next
- Name the rule "Allow Microsoft Teams Outbound" > Finish
- Repeat this process for
Update.exe,Electron.exe, andTeamsHost.exeto cover all background processes.
Create Inbound Rules (For Calls & Screen Sharing)
Inbound rules let other users connect to your Teams sessions:- Right-click "Inbound Rules" > "New Rule"
- Select "Program" > Next
- Browse to
Teams.exe> Next - Choose "Allow the connection" > Next
- Select the relevant network types > Next
- Name the rule "Allow Microsoft Teams Inbound" > Finish
- As an alternative, you can use the basic firewall interface: Go to "Allow an app or feature through Windows Defender Firewall", click "Change settings", find "Microsoft Teams" (or add it manually if missing), and check the boxes for the networks you use.
Optional: Port-Based Rules (Granular Control)
If you need fine-grained port access, Teams uses these primary ports:- UDP 3478-3481 (STUN for call connectivity)
- TCP 443 (HTTPS for messages and updates)
- UDP 50000-50019 (Media streaming for calls/sharing)
Create port-based rules for these if program-based rules aren't sufficient for your environment.
内容的提问来源于stack exchange,提问作者Dummy




