Basic Proxy Configuration
Configuration Parameters
Enable the use of a proxy server for all network requests made by the provider.When set to
true, the provider will route all HTTP requests through the specified proxy server. Requires proxy_url to be set.Can be set using the M365_USE_PROXY environment variable.The URL of the proxy server.Must be a valid URL including the scheme (http:// or https://) and can include a port number.Format:
http://hostname:port or https://hostname:portRequired when use_proxy is true. Ignored if use_proxy is false.Can be set using the M365_PROXY_URL environment variable.Username for proxy authentication.Optional. Only needed if your proxy server requires authentication. Used in conjunction with
proxy_password.Can be set using the M365_PROXY_USERNAME environment variable.Password for proxy authentication.Optional. Only needed if your proxy server requires authentication. Used in conjunction with
proxy_username.Treated as sensitive information and will be masked in logs.Can be set using the M365_PROXY_PASSWORD environment variable.Unauthenticated Proxy
For proxy servers that do not require authentication:Authenticated Proxy
For proxy servers that require username and password authentication:HTTPS Proxy
For HTTPS proxy servers:Using Variables for Proxy Configuration
Complete Configuration Example
Environment Variable Example
Create a.env file (never commit this file):
Testing Proxy Configuration
To verify your proxy configuration is working:- Enable debug mode:
- Run a simple Terraform operation:
- Check the Terraform logs for proxy-related messages.
Common Proxy Scenarios
Corporate Network with Authenticated Proxy
Development Environment with Local Proxy
CI/CD Pipeline with Proxy
Troubleshooting
Connection timeout through proxy
Connection timeout through proxy
- Verify the proxy URL is correct and accessible
- Check that the proxy server is running and accepting connections
- Ensure firewall rules allow traffic to the proxy server
- Try increasing
timeout_secondsin client_options
Authentication failed with proxy
Authentication failed with proxy
- Verify proxy username and password are correct
- Check if the proxy requires domain credentials (e.g., DOMAIN\username)
- Ensure special characters in credentials are properly escaped
- Test proxy credentials using curl or another tool
SSL/TLS errors through proxy
SSL/TLS errors through proxy
- Some proxies intercept HTTPS traffic and may cause certificate validation errors
- Check with your network administrator about SSL inspection policies
- Ensure the proxy’s CA certificate is trusted on your system
Proxy works but authentication fails
Proxy works but authentication fails
- The proxy configuration only affects HTTP client connections
- Authentication to Microsoft Entra ID may require additional network access
- Verify that the proxy allows access to Microsoft authentication endpoints
Best Practices
Use Environment Variables
Always use environment variables for proxy credentials instead of hardcoding them in configuration files.
Test Without Proxy First
If possible, test your configuration without a proxy first to isolate proxy-related issues.
Enable Debug Mode
Enable debug_mode when troubleshooting proxy connectivity issues to see detailed logs.
Document Proxy Requirements
Document your proxy requirements and configuration in your project’s README for team members.
Secure Credentials
Never commit proxy credentials to version control. Use secret management tools or environment variables.
