Az
azops-mcp

Configuration

All environment variables and how the server loads them.


Overview

Configuration is managed by the ServerConfig dataclass in config.py. It reads environment variables at startup via python-dotenv (from a .env file) and os.getenv() with defaults. A global singleton config is created at import time and used throughout the application.


Environment Variables

Azure Authentication

VariableDefaultDescription
AZURE_SUBSCRIPTION_IDDefault subscription ID. Can also be set via set_subscription tool at runtime.
AZURE_TENANT_IDAzure AD tenant ID (for Service Principal auth)
AZURE_CLIENT_IDService Principal application/client ID
AZURE_CLIENT_SECRETService Principal secret
AZURE_DEFAULT_LOCATIONeastusDefault Azure region for new resources

If AZURE_CLIENT_ID, AZURE_CLIENT_SECRET, and AZURE_TENANT_ID are all set, the server uses Service Principal authentication. Otherwise, it falls back to Azure CLI / Managed Identity.

Server Settings

VariableDefaultDescription
LOG_LEVELINFOLogging verbosity: DEBUG, INFO, WARNING, ERROR, CRITICAL
LOG_FORMAT(standard format)Python logging format string
API_TIMEOUT30HTTP request timeout in seconds
API_RETRY_ATTEMPTS3Number of retry attempts for API calls
API_RETRY_DELAY1Delay between retries in seconds
DEBUGfalseEnable debug mode (verbose error messages)

Rate Limiting

VariableDefaultDescription
RATE_LIMIT_ENABLEDtrueEnable/disable rate limiting
RATE_LIMIT_REQUESTS_PER_MINUTE60Maximum requests per minute per key
RATE_LIMIT_BURST_SIZE10Burst allowance above the per-minute rate

Docker & Monitoring

VariableDefaultDescription
DOCKER_TIMEOUT30Timeout for Docker CLI commands in seconds
MONITORING_INTERVAL60Default interval for monitoring checks in seconds

Security

VariableDefaultDescription
SECRET_KEYdefault-secret-key-change-in-productionApplication secret key
ALLOWED_HOSTSlocalhost,127.0.0.1Comma-separated allowed hostnames

Validation

ServerConfig.validate() checks for common misconfigurations:

CheckCondition
Log levelMust be one of DEBUG, INFO, WARNING, ERROR, CRITICAL
Timeoutsapi_timeout, docker_timeout, monitoring_interval must be > 0
Rate limitsrate_limit_requests_per_minute, rate_limit_burst_size must be > 0
Service PrincipalIf any of client_id/client_secret/tenant_id is set, all must be set
SubscriptionAZURE_SUBSCRIPTION_ID is required (warning)

Example .env File

.envbash
# Minimal — uses az login credentials
AZURE_SUBSCRIPTION_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

# Optional: Service Principal
# AZURE_TENANT_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
# AZURE_CLIENT_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
# AZURE_CLIENT_SECRET=your-secret

# Defaults
AZURE_DEFAULT_LOCATION=eastus
LOG_LEVEL=INFO
API_TIMEOUT=30
RATE_LIMIT_ENABLED=true
RATE_LIMIT_REQUESTS_PER_MINUTE=60
DEBUG=false