Past graphic of compute utilization for sql server

Dağhan Karahan 0 Reputation points
2025-03-18T10:54:06.88+00:00

Hello,

I am looking for a way to retrieve past compute utilization data in Azure. Specifically, I need to analyze CPU, memory, and overall usage metrics for virtual machines over a historical period.

I have explored Azure Monitor and Metrics but couldn't find a straightforward way to access detailed historical data beyond the default retention period. Is there an option to retrieve this data via API, logs, or any other method?

Any guidance on this would be greatly appreciated. Thanks in advance!

Best regards

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
9,013 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Anusree Nashetty 4,375 Reputation points Microsoft External Staff Moderator
    2025-03-19T08:45:25.9766667+00:00

    Hi Dağhan Karahan,

    To retrieve historical compute utilization data for Azure Virtual Machines beyond the default retention period, you can use a combination of Azure Monitor, Log Analytics, and Azure Storage.

    Export metrics to an Azure Storage account for long-term retention, you can query or retrieve the data programmatically.
    Create a Storage account, add a diagnostic setting to export metrics to your storage account and select the metrics you want to export. For detailed information: Export Metrics to Storage
    Use Azure Storage SDKs, Azure CLI, or Azure PowerShell to retrieve the historical data from the storage account.

    Azure Log Analytics can collect and store performance data (e.g., CPU, memory) from your VMs for extended periods. You can query this data using Kusto Query Language (KQL).
    Enable Azure Monitor for VMs, which will start collecting performance data and sending it to a Log Analytics workspace. For reference: Enable Azure Monitor for VMs
    Use KQL to query performance data in Log Analytics. Log Analytics Query Language (KQL)
    Log Analytics allows you to configure data retention for up to two years. Data Retention in Log Analytics

    You can use the Azure Monitor REST API to programmatically retrieve historical metrics data. Please refer to Azure Monitor REST API Filter

    If you have any further queries, let me know. If the answer is helpful, please click Upvote on it.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.