Migrate from Azure AI Anomaly Detector and Metrics Advisor¶
Microsoft retired Azure AI Anomaly Detector on October 1, 2026. If your pipelines call the univariate entire/last endpoints, the multivariate API, or Azure Metrics Advisor feeds built on the same Spectral Residual and STL families, PySAD gives you self-hosted Python equivalents under the BSD 3-Clause license.
Scope and operational differences¶
PySAD is an in-process Python library, not a managed cloud service:
No hosted REST API or scheduling engine: Run the detectors inside your own Kafka/Flink worker or microservice (see Serve detectors in production).
One observation at a time: Rather than re-sending overlapping historical arrays per HTTP request, PySAD maintains bounded rolling state in memory across
fit_score_partialcalls.No severity margin bands or root-cause UI: Detectors emit an anomaly score (or binary
0/1alert viapredict_partial), notexpectedValue,upperMargin, or multi-dimension incident trees. If you need forecast deviations on seasonal telemetry, pairHoltWintersorPredictiveAnomalyDetector.
API mapping¶
Azure capability |
PySAD replacement |
Notes |
|---|---|---|
Univariate |
Port of Microsoft’s SR algorithm from the Azure paper. |
|
Univariate |
Modified STL decomposition + generalized ESD test; positive scores flag anomalies. |
|
Custom |
Maps raw scores to empirical tail probabilities in |
|
Tail alert tuning with drift |
Extreme-value threshold ( |
|
Multivariate Anomaly Detection ( |
Scales across correlated sensor vectors with bounded memory. |
|
|
Detects mean or distribution shifts online without storing the full stream. |
|
Multi-metric Metrics Advisor feeds |
Dictionary of pipelines keyed by |
Keep per-series rolling windows isolated in Python or Redis/stateful workers. |
Replace univariate detect_last_point¶
Azure’s univariate API splits workloads into non-seasonal Spectral Residual and periodic STL/ESD checks. You can keep Spectral Residual directly in Python and convert its saliency scores into calibrated binary alerts, or use SeasonalHybridESD for hourly or daily cycles (see also Detect anomalies in seasonal series):
import numpy as np
from pysad.models import SpectralResidual
from pysad.transform.postprocessing import ThresholdFilter
from pysad.transform.probability_calibration import ConformalProbabilityCalibrator
rng = np.random.default_rng(0)
signal = 50.0 + rng.normal(scale=0.3, size=250)
signal[210:215] = 65.0 # injected anomaly burst
pipeline = (
SpectralResidual(window_size=64)
| ConformalProbabilityCalibrator(window_size=200)
| ThresholdFilter(threshold=0.99)
)
for step, value in enumerate(signal):
alert = pipeline.fit_predict_partial(np.array([value]))
if alert == 1 and step >= 100:
print(f"anomaly at step {step}: value={value:.2f}")
Replace multivariate anomaly detection¶
Azure’s multivariate endpoint learns correlations across multiple numeric time series. In PySAD, normalize features online with StandardScaler, score with a bounded multivariate detector, and attach a calibrator and threshold:
import numpy as np
from pysad.models import OnlineIsolationForest
from pysad.transform.postprocessing import ThresholdFilter
from pysad.transform.preprocessing import StandardScaler
from pysad.transform.probability_calibration import ConformalProbabilityCalibrator
rng = np.random.default_rng(42)
normal = rng.normal(loc=0.0, scale=1.0, size=(300, 4))
normal[260] = [6.0, 6.0, -6.0, -6.0] # cross-sensor correlation break
pipeline = (
StandardScaler()
| OnlineIsolationForest(num_trees=50, window_size=256, random_state=42)
| ConformalProbabilityCalibrator(window_size=200)
| ThresholdFilter(threshold=0.99)
)
for step, x in enumerate(normal):
alert = pipeline.fit_predict_partial(x)
if alert == 1 and step >= 150:
print(f"multivariate alert at step {step}")
Next steps¶
Tune alert sensitivity, smoothing, and conformal p-values in Turn scores into alerts.
Run your pipelines behind FastAPI or a stream consumer in Serve detectors in production.
Handle hourly or weekly cycles explicitly in Detect anomalies in seasonal series.