Hello azim
Welcome to Microsoft Q&A Platform, thanks for posting your query here.
By default, Azure Monitor stores metrics for approximately 3 months. If you want to keep the metrics beyond 3 months, you can use Azure Monitor Log Analytics to store the metrics for a longer period of time.
To store metrics in Log Analytics, you need to create a Log Analytics workspace and configure Azure Monitor to send the metrics to the workspace.
Ref:
https://learn.microsoft.com/en-us/azure/azure-monitor/logs/log-analytics-workspace-overview
https://learn.microsoft.com/en-us/azure/azure-monitor/visualize/tutorial-logs-dashboards
https://learn.microsoft.com/en-us/azure/azure-monitor/vm/tutorial-monitor-vm-guest
Once the metrics data is in the Log Analytics workspace, you can use Log Analytics to query and analyze the data. You can also create custom dashboards and alerts based on the metrics data. You can set the retention period. Once the retention period is set, Log Analytics will store the metrics data for the specified period of time.
Please note that storing metrics data in Log Analytics will incur additional costs. You can refer to the Azure Monitor pricing page for more information on pricing.
https://azure.microsoft.com/en-in/pricing/details/monitor/
Hope this helps.