-
Notifications
You must be signed in to change notification settings - Fork 247
Microsoft 365 Connection Speed Test
The test-m365-connect-speed.ps1 script is a comprehensive PowerShell tool designed to test network connectivity, performance, and authentication status for Microsoft 365 services. It provides detailed analysis of connection quality, latency, and bandwidth to help diagnose M365 connectivity issues.
- DNS Resolution Testing: Measures time to resolve M365 service domains
- Port Connectivity Testing: Verifies TCP connections to M365 endpoints
- HTTPS Response Testing: Tests HTTP/HTTPS response times and status codes
- Bandwidth Testing: Optional download speed testing via M365 endpoints
- Authentication Testing: Optional testing of authenticated M365 API calls
- Public IP Detection: Identifies the workstation's public IP address
- Secure Azure Blob Storage Upload: Anonymous, secure upload to CIAOPS storage
- Unlimited Upload Quota: No restrictions on number of uploads
- Private Storage: Uploaded files are not publicly accessible
- Data Anonymization: User identifiers are hashed for privacy
- Console Output: Real-time colored console display
- HTML Report: Interactive, responsive web report with charts
- CSV Export: Structured data for analysis
- JSON Export: Machine-readable format for integration
- PowerShell 5.1 or later (PowerShell 7+ recommended)
# Microsoft Graph PowerShell
Install-Module Microsoft.Graph -Scope CurrentUser
# Exchange Online Management
Install-Module ExchangeOnlineManagement -Scope CurrentUser
# SharePoint Online Management
Install-Module Microsoft.Online.SharePoint.PowerShell -Scope CurrentUser
# Microsoft Teams PowerShell
Install-Module MicrosoftTeams -Scope CurrentUser- Internet connectivity
- Access to Microsoft 365 endpoints (ports 80, 443)
- Firewall/proxy allowing connections to M365 services
.\test-m365-connect-speed.ps1Tests all M365 endpoints with default settings and generates an HTML report.
.\test-m365-connect-speed.ps1 -IncludeBandwidthTest -TestDuration 30Includes bandwidth testing for 30 seconds per endpoint.
.\test-m365-connect-speed.ps1 -IncludeAuthenticationPrompts for M365 authentication and tests API access.
.\test-m365-connect-speed.ps1 -OutputFormat CSV -OutputPath "C:\Reports\m365-test.csv"Exports results to CSV format at specified location.
.\test-m365-connect-speed.ps1 -UploadResultsAutomatically uploads results to CIAOPS for analysis.
.\test-m365-connect-speed.ps1 -ShowUploadStatsDisplays current upload quota and usage statistics.
.\test-m365-connect-speed.ps1 -DetailedLoggingEnables detailed transcript logging to file.
| Parameter | Type | Default | Description |
|---|---|---|---|
TestDuration |
Int | 10 | Duration in seconds for bandwidth testing (5-300) |
IncludeBandwidthTest |
Switch | False | Include bandwidth/speed testing |
OutputFormat |
String | "HTML" | Output format: Console, CSV, JSON, HTML |
OutputPath |
String | Auto | Custom path for output files |
DetailedLogging |
Switch | False | Enable detailed logging to file |
IncludeAuthentication |
Switch | False | Include M365 authentication testing |
SkipAuthenticationCheck |
Switch | False | Skip checking existing authentication |
UploadResults |
Switch | False | Upload results to CIAOPS Azure storage |
ShowUploadStats |
Switch | False | Display upload statistics and quota |
-
Exchange Online
- Primary:
outlook.office365.com - Secondary:
outlook.office.com - Port: 443 (HTTPS)
- Primary:
-
SharePoint Online
- Primary:
sharepoint.com - Secondary:
*.sharepoint.com - Port: 443 (HTTPS)
- Primary:
-
Microsoft Teams
- Primary:
teams.microsoft.com - Secondary:
teams.live.com - Port: 443 (HTTPS)
- Primary:
-
OneDrive for Business
- Primary:
onedrive.live.com - Secondary:
*.files.1drv.com - Port: 443 (HTTPS)
- Primary:
-
Azure Active Directory
- Primary:
login.microsoftonline.com - Secondary:
login.windows.net - Port: 443 (HTTPS)
- Primary:
-
Office Online
- Primary:
office.com - Secondary:
www.office.com - Port: 443 (HTTPS)
- Primary:
-
Microsoft Graph
- Primary:
graph.microsoft.com - Secondary:
graph.windows.net - Port: 443 (HTTPS)
- Primary:
-
Power Platform
- Primary:
make.powerapps.com - Secondary:
powerapps.microsoft.com - Port: 443 (HTTPS)
- Primary:
-
Microsoft Viva
- Primary:
myanalytics.microsoft.com - Secondary:
insights.viva.office.com - Port: 443 (HTTPS)
- Primary:
-
Microsoft Purview
- Primary:
compliance.microsoft.com - Secondary:
purview.microsoft.com - Port: 443 (HTTPS)
- Primary:
- Parameter validation and default value assignment
- Logging setup (if detailed logging enabled)
- Azure upload configuration loading
- Public IP address detection
- Check existing authentication status for M365 services
- Prompt for interactive authentication if needed
- Establish connections to requested services
For each M365 endpoint:
- DNS Resolution Test: Measure domain name resolution time
- Port Connectivity Test: Test TCP connection to port 443
- HTTPS Response Test: Send HTTP request and measure response time
- Authentication Test: Test API access (if authenticated)
- Test download speeds using stable M365 endpoints
- Measure throughput and connection stability
- Calculate average speeds across multiple requests
- Calculate summary statistics and connection quality ratings
- Generate output in requested format(s)
- Display results and recommendations
- Prompt user for upload consent (interactive mode)
- Generate HTML report for upload if needed
- Securely upload to CIAOPS Azure Blob Storage
- Display upload confirmation and statistics
The script provides automatic connection quality assessment based on average latency:
| Rating | Latency Range | Description | User Experience |
|---|---|---|---|
| Excellent | < 100ms | Outstanding performance | Ideal for real-time collaboration and video conferencing |
| Good | 100-199ms | Very responsive | Suitable for most M365 activities including Teams calls |
| Fair | 200-299ms | Noticeable delays | Minor delays in real-time applications |
| Poor | 300-499ms | Significant delays | Video calls may be choppy, slower file operations |
| Very Poor | ≥ 500ms | Severe delays | Productivity impact, network optimization needed |
- Interactive Dashboard: Real-time metrics with color-coded status
- Responsive Design: Mobile and desktop optimized
- Visual Charts: Latency distribution and performance trends
- Service Details: Comprehensive breakdown per M365 service
- Recommendations: Automated suggestions based on test results
- Export Options: Print-friendly and shareable format
Service,Endpoint,Description,OverallSuccess,TotalLatency,DNSSuccess,DNSTime,PortSuccess,PortTime,HTTPSSuccess,HTTPSTime,HTTPSStatus,AuthSuccess,AuthTime,AuthInfo,WorkstationPublicIP{
"Summary": {
"TestStart": "datetime",
"TestEnd": "datetime",
"TotalEndpoints": "number",
"SuccessfulConnections": "number",
"FailedConnections": "number",
"AverageLatency": "number",
"MaxLatency": "number",
"MinLatency": "number"
},
"TestResults": [...],
"BandwidthResults": [...],
"AuthenticationStatus": {...}
}- Anonymous Identification: User identifiers are SHA256 hashed
- No Personal Data: No personally identifiable information collected
- Secure Transmission: All uploads use HTTPS encryption
- Private Storage: Uploaded files stored in private Azure containers
- Write-Only Access: SAS tokens only allow file upload
- No Public Access: Uploaded files cannot be viewed by others
- Unique File Names: Each upload gets a randomized, unique identifier
- Time-Limited Access: SAS tokens have expiration dates
- Firewall Friendly: Uses standard HTTPS ports (80, 443)
- Proxy Compatible: Works through corporate proxies
- No Admin Rights: Runs with standard user permissions
- Symptom: DNS tests fail consistently
- Causes: Corporate DNS restrictions, firewall blocking
-
Solutions:
- Check DNS server configuration
- Verify M365 URLs are not blocked
- Test from different network location
- Symptom: Port 443 connections fail
- Causes: Firewall restrictions, proxy configuration
-
Solutions:
- Review firewall rules for M365 endpoints
- Configure proxy settings if required
- Check corporate network policies
- Symptom: M365 service authentication fails
- Causes: Missing PowerShell modules, MFA requirements
-
Solutions:
- Install required PowerShell modules
- Use modern authentication methods
- Configure conditional access policies
- Symptom: Results upload to CIAOPS fails
- Causes: Network connectivity, proxy issues
-
Solutions:
- Check internet connectivity
- Verify proxy settings allow Azure Blob Storage
- Try upload from different network
- Run tests during normal business hours
- Test from primary work location/network
- Avoid running during network maintenance windows
- Close bandwidth-intensive applications
- Skip bandwidth testing for quick results
- Disable authentication testing if not needed
- Use console output format for speed
- Run without detailed logging
-
Test-DNSResolution: DNS lookup timing -
Test-PortConnectivity: TCP connection testing -
Test-HTTPSConnection: HTTP response testing -
Test-HTTPSRequest: Low-level HTTP request handling
-
Test-M365Authentication: Check authentication status -
Connect-M365Services: Interactive service connection -
Test-AuthenticatedEndpoint: API access validation
-
Get-PublicIPAddress: External IP detection -
Format-LocalDateTime: Localized date formatting -
Write-TestProgress: Progress indication
-
New-HTMLReport: Generate interactive HTML reports
-
Upload-ToAzureBlob: Secure Azure Blob Storage upload
$AzureUploadConfig = @{
SasUrl = "https://m365testresults.blob.core.windows.net/m365-metric-uploads?[SAS_TOKEN]"
ContainerName = "m365-metric-uploads"
StorageAccount = "m365testresults"
}All M365 endpoints are configured in the $M365Endpoints hashtable with:
- Primary and secondary endpoints
- Port numbers
- Protocol specifications
- Service descriptions
- Regular Testing: Run weekly connectivity tests
- Baseline Establishment: Document normal performance metrics
- Trend Monitoring: Track performance changes over time
- Documentation: Maintain test results for troubleshooting
- Test Before Issues: Run tests when experiencing problems
- Multiple Locations: Test from different network locations
- Time Variations: Test at different times of day
- Share Results: Upload results to help improve global insights
- DNS Optimization: Implement local DNS caching
- Bandwidth Management: Monitor and optimize bandwidth usage
- Proxy Configuration: Ensure optimal proxy settings
- Firewall Rules: Maintain current M365 endpoint allowlists
# Daily automated test with upload
.\test-m365-conne-speed.ps1 -UploadResults -OutputFormat JSON -OutputPath "C:\Monitoring\m365-$(Get-Date -Format 'yyyy-MM-dd').json"# Programmatic usage
$results = .\test-m365-connect-speed.ps1 -OutputFormat JSON
$summary = $results.Summary
if ($summary.AverageLatency -gt 200) {
# Trigger alert or remediation
}- Schedule regular automated tests
- Email results to IT team
- Integrate with monitoring systems
- Release Date: July 2025
- Features: Complete M365 connectivity testing suite
- Security: Azure Blob Storage integration
- Platforms: PowerShell 5.1+ on Windows
- PowerShell Core support for cross-platform testing
- Additional M365 service endpoint coverage
- Advanced analytics and AI-powered insights
- Integration with Azure Monitor and Log Analytics
- Email: support@ciaops.com
- Website: https://www.ciaops.com
- Documentation: https://github.com/directorcia/Office365/wiki
- GitHub Repository: https://github.com/directorcia/Office365
- Microsoft 365 Network Connectivity: https://aka.ms/m365networkconnectivity
- Official Connectivity Test Tool: https://connectivity.office.com
This script is provided as-is for testing and diagnostic purposes. While it follows Microsoft recommended practices for M365 connectivity testing, results should be interpreted in the context of your specific network environment and requirements.
The script uploads anonymized data to help improve global M365 connectivity insights. All data is handled in accordance with privacy best practices and is not used for any commercial purposes beyond improving the service.
Documentation last updated: July 21, 2025 Script version: 1.0 Author: CIAOPS