
Azure Metrics Advisor is a cloud-based platform that helps you monitor and analyze your data in real-time. It allows you to create custom dashboards and alerts to stay on top of your metrics.
To get started with Azure Metrics Advisor, you'll first need to create a workspace. This is where you'll store and manage all your metrics data. You can create a workspace in the Azure portal or through the Azure CLI.
Metrics Advisor supports a wide range of data sources, including Azure Monitor, Azure Storage, and Azure SQL Database. This means you can easily connect your existing data sources to Metrics Advisor and start analyzing your metrics right away.
Get Started Today
To get started with Azure Metrics Advisor, head to the Azure portal to create your new Metrics Advisor resource.
You can also learn more about the service capabilities by reading the Metrics Advisor document.
Find the sample dataset mentioned in the blog here.
Read more data science articles on OpenDataScience.com, including tutorials and guides from beginner to advanced levels.
Subscribe to our weekly newsletter here to receive the latest news every Thursday.
Get data science training on-demand wherever you are with our Ai+ Training platform.
Configuring the Service
To configure the service for your organization's specifications, you can use the guided autotuning experience, which allows you to provide your detection preferences, such as level of sensitivity, anomaly pattern, or input value range.
The service will then automatically adjust the configuration for each time-series dataset on the system, and you can quickly evaluate the effectiveness of the configuration with the provided estimate generated by the service running the customized model through historical data.
To get started with Azure Metrics Advisor, you'll need an Azure subscription and an existing Metrics Advisor resource.
Prerequisites
To configure the service, you'll need to meet some essential prerequisites.
First and foremost, you'll need to assign your account as the 'Cognitive Services Metrics Advisor Administrator' role. This is a crucial step that will give you the necessary permissions to manage your Metrics Advisor resource.
Having an Azure subscription is also a must-have. You can't configure the service without one.
You'll also need an existing Metrics Advisor resource. This is where all the magic happens, and you'll be working with it closely.
To get started with Option 2, you'll need to use the Azure CLI. This is a powerful tool that will help you automate many tasks.
Before triggering auto-tuning, the system needs some time to perform statistics on the metrics. It will show a status of Initializing at the beginning, so be patient.
To obtain the API key, you'll need to log in to the Metrics Advisor Web Portal. Once you're logged in, you'll need to fill in your Azure Active Directory, subscription, and Metrics Advisor resource name.
Create a Resource
To create a Metrics Advisor resource, you'll need an Azure subscription and an existing Metrics Advisor resource. This is a crucial step in deploying your Metrics Advisor instance.
You can create a Metrics Advisor resource using the Azure Portal, Azure CLI, or by creating a new resource in the Azure portal.
First, ensure you have the necessary permissions. A user with subscription administrator or resource group administrator privileges is required.
To create a Metrics Advisor resource using the Azure Portal, navigate to the Metrics Advisor resource in the Azure portal and select the Access control (IAM) tab.
You'll need to select 'Add role assignments', pick the 'Cognitive Services Metrics Advisor Administrator' role, and then select your account. After that, simply select the 'Save' button.
Alternatively, you can use the Azure CLI to create a Metrics Advisor resource. However, this option is not detailed in the provided article sections.
Create a Hook
Creating a hook in Metrics Advisor is a straightforward process. You can choose from four types of hooks: Email hook, Webhook, Teams hook, and Azure DevOps hook.
Each hook type corresponds to a specific channel for receiving anomaly alerts. For example, an Email hook sends notifications via email, while a Webhook sends notifications through a web interface.
To create a hook, you can use the EmailNotificationHook or WebNotificationHook classes. Note that you need to pass the hook to an anomaly alert configuration to start getting notifications.
Here are the four types of hooks in Metrics Advisor:
- Email hook
- Webhook
- Teams hook
- Azure DevOps hook
This will enable you to receive anomaly alerts through different channels, depending on your preference.
Configure the Service for Your Organization
To configure the service for your organization, you'll need to adapt it to surface the anomalies that matter to you. This can be done using the guided autotuning experience, where you provide your detection preferences, such as level of sensitivity, anomaly pattern, or input value range.
The service will automatically adjust the configuration for each time-series dataset on the system. You can quickly evaluate the effectiveness of the configuration with the provided estimate generated by the service running the customized model through historical data.
You'll also get a suggested alert rule from the service that can be further customized for mission-critical notifications.
To get started, you'll need to have an Azure subscription and an existing Metrics Advisor resource.
Here are the prerequisites:
- An Azure subscription
- An existing Metrics Advisor resource
You can configure the service using Azure CLI, which provides a more efficient way to automate tasks.
To configure the service using Azure CLI, you'll need to install the Azure Metrics Advisor client library for .NET with NuGet. This will give you access to the necessary tools to configure the service.
Once you have the client library installed, you can create a MetricsAdvisorClient or a MetricsAdvisorAdministrationClient to perform the necessary configuration tasks.
Here are the options for creating a MetricsAdvisorClient or a MetricsAdvisorAdministrationClient:
- Create a MetricsAdvisorKeyCredential with the endpoint and subscription key
- Create a MetricsAdvisorClient with the endpoint and key credential
- Create a MetricsAdvisorAdministrationClient to perform administration operations
To obtain the endpoint and subscription key, you can use the Azure CLI snippet below or get the resource information in the Azure Portal.
You can also obtain the API key from the Metrics Advisor Web Portal. To do this, log in to the portal, fill in your Azure Active Directory, Subscription, and Metrics Advisor resource name, and then obtain the API key.

With the API key, you can create a MetricsAdvisorClient or a MetricsAdvisorAdministrationClient to perform the necessary configuration tasks.
Here are the methods available for the MetricsAdvisorClient:
- Listing incidents
- Retrieving root causes of incidents
- Retrieving time series data
Here are the methods available for the MetricsAdvisorAdministrationClient:
- Creating and updating data feeds
- Anomaly detection configurations
- Anomaly alerting configurations
Data Onboarding and Management
Data onboarding is a crucial step in getting started with Azure Metrics Advisor. You'll need to register parameters such as your data source, connection details, and ingestion granularity.
Onboarding is a simple process that can be done in just a few minutes if you have all the necessary information handy. You can refer to the Azure Metrics Advisor documentation for more details.
You can use Azure Metrics Advisor through a web-based workspace or through SDK, and the entire onboarding process can be completed using the Metrics Advisor client libraries REST API.
Data Onboarding
Data onboarding is a crucial step in getting your data ready for Azure Metrics Advisor. This involves registering parameters such as the data source, connection details, and ingestion granularity.
The onboarding process is relatively simple and can be completed in a few minutes if you have all the necessary parameters handy. You can refer to the Azure Metrics Advisor documentation for more details.
Azure Metrics Advisor can be used through a web-based workspace or through SDK, with the latter providing a REST API. This gives you flexibility in how you choose to work with the service.
Ingesting data from a data source is the first step in using Azure Metrics Advisor, and this is done through a DataFeed. This is the entry point of data and is required before anomaly detection can take place.
A DataFeed can ingest multiple metrics from the same data source, making it a powerful tool for monitoring and analysis.
Preset Events
Preset events are a feature that can help you manage anomalies in your data, especially during holidays or other expected events.
You can configure preset events after your data feed is onboarded, and each metric can only have one preset event configuration.
To set up a preset event, go to the metric details page and click on the "Configure Preset Event" button next to the metrics drop-down list.
In the window that appears, make sure to select the "Enable holiday event" option to use the configuration.
The Holiday event section allows you to suppress unnecessary anomalies detected during holidays. You can choose between two strategies: "Suppress holiday" and "Holiday as weekend".
If you choose "Suppress holiday", all anomalies and alerts will be suppressed during the holiday period. If you choose "Holiday as weekend", the average expected values of several corresponding weekends before the holiday will be calculated, and the anomaly status will be based on these values.
You can choose one dimension as the country, which is useful if your data contains country information. For example, you can choose a dimension that contains a country code.
The Country code mapping option allows you to map a standard country code to the chosen dimension's country data.
You can also choose whether to take into account all holidays, only PTO (Paid Time Off) holidays, or only Non-PTO holidays.
The Days to expand option allows you to specify the impacted days before and after a holiday.
Here's a summary of the Holiday event section options:
The Cycle event section can be used to reduce unnecessary alerts by using cyclic patterns in the data. For example, you can use it for metrics that have multiple patterns or cycles, such as both a weekly and monthly pattern.
The available options per granularity are as follows:
Note that when using a custom granularity in seconds, only available if the metric is longer than one hour and less than one day.
Detection Methods
Azure Metrics Advisor offers multiple anomaly detection methods, including Hard threshold, Smart detection, and Change threshold. These methods can be combined using logical operators to create a robust anomaly detection system.
Hard threshold is a basic method for anomaly detection, where you can set an upper and/or lower bound to determine the expected value range. Any points that fall out of this boundary will be identified as an anomaly.
Smart detection, on the other hand, is powered by machine learning that learns patterns from historical data and uses them for future detection. The Sensitivity parameter is the most important one for tuning the detection results in Smart detection mode.
Change threshold is used when metric data generally stays around a certain range. You can set the threshold according to the Change percentage, and the mode can detect anomalies in scenarios where data is normally stable and smooth, or normally unstable and fluctuates a lot.
Here are the three anomaly detection methods in a table for easy comparison:
By understanding these detection methods, you can choose the one that best fits your specific use case and fine-tune the configuration to get the best detection results.
Set Up Alerts
To set up alerts in Azure Metrics Advisor, you need to create a hook that will send notifications to the desired channel. A hook is a bridge that enables you to subscribe to metrics anomalies and send notifications through different channels.
There are four types of hooks in Metrics Advisor: Email hook, Webhook, Teams hook, and Azure DevOps hook. Each hook type corresponds to a specific channel that anomaly will be notified through.
To send anomaly notifications through a Microsoft Teams channel, you'll need to add an 'Incoming Webhook' connector to your Teams channel. This involves navigating to the Teams channel, selecting 'Connectors', and searching for 'Incoming Webhook'.
Once you've added the connector, you'll receive a URL that you'll need to copy and paste into the Metrics Advisor portal. This URL will be used to create a new 'Teams hook' in Metrics Advisor.
To create a Teams hook, select the 'Hooks' tab in the left navigation bar and click on the 'Create hook' button. Choose the hook type 'Teams' and input a name, then paste the URL you copied earlier.
After creating the Teams hook, you'll need to apply it to an alert configuration. This involves selecting a data feed, a metric within the feed, and creating an 'alerting configuration' to subscribe to anomalies that are detected and notify through a Teams channel.
You can specify the conditions an anomaly must satisfy to trigger an alert with an AnomalyAlertConfiguration, which makes use of hooks to send notifications to the concerned parties every time an alert is triggered.
Frequently Asked Questions
What is Azure AI Metrics Advisor?
Azure AI Metrics Advisor is a monitoring service that diagnoses issues by analyzing metrics. It's available to try for free with a pay-as-you-go account.
What is the difference between Azure monitor and advisor?
Azure Advisor offers personalized recommendations for optimizing Azure resources, while Azure Monitor collects and analyzes telemetry data to inform actions. In essence, Advisor advises on setup, while Monitor watches and reports on performance.
What does Azure Advisor do?
Azure Advisor provides personalized recommendations to optimize your Azure resources for reliability, security, and cost. It helps you improve your Azure setup for better performance and operational excellence.
Sources
- https://azure.microsoft.com/en-us/products/ai-services/ai-metrics-advisor
- https://odsc.medium.com/aiops-with-azure-metrics-advisor-5c473b5d4fab
- https://docs.azure.cn/en-us/ai-services/metrics-advisor/tutorials/enable-anomaly-notification
- https://azuresdkdocs.blob.core.windows.net/$web/dotnet/Azure.AI.MetricsAdvisor/1.0.0-beta.2/index.html
- https://learn.microsoft.com/en-us/azure/ai-services/metrics-advisor/how-tos/configure-metrics
Featured Images: pexels.com