This article is contributed. See the original author and article here.

By using these collected metrics, you can create custom monitoring rules and alerts. Azure SQL Analytics helps you to identify issues at each layer of your application stack. It uses Azure Diagnostic metrics along with Azure Monitor views to present data about all your Azure SQL databases in a single Log Analytics work-space. Azure Monitor helps you to collect, correlate, and visualize structured and unstructured data. More information can be found here.


 


Let us Begin:



  1. From Azure Portal search field go to Log Analytics workspaces the click Add, please have a look at the following snapshot:
    Mustafa_Ashour_0-1622214935662.png

     





  2. Fill the values then click on OK, please have a look at the following snapshot:
    Mustafa_Ashour_1-1622214935880.png

     





  3. Go to your Azure SQL MI that you want to create an alert for it, then click on Diagnostic Settings (Left-menu), please have a look at the following snapshot:
    Mustafa_Ashour_2-1622214935500.png

     





  4. From the right-side, click on the Add diagnostic setting and select the Log Analytics work space that you have created above then click on save, please have a look at the following snapshots:
    Mustafa_Ashour_3-1622214935274.png

     




    Mustafa_Ashour_4-1622214935372.png

     





  5. Click on the Log Analytic Workspace that we have created, please have a look at the following snapshot:
    Mustafa_Ashour_5-1622214935368.png

     





  6. From the right-side, click on view logs under Search and analyze logs, please have a look at the following snapshot:
    Mustafa_Ashour_6-1622214935866.png

     



  7. From the Queries dialog, select Topic from the top-left drop down list then Azure diagnostics from All Queries and finally click Load To Editor, please have a look at the following snapshot:
    Mustafa_Ashour_7-1622214935411.png

     





  8. Clear the editor and copy the query from here (This query is responsible on monitoring if Azure MI storage is above 90%) then paste it in the editor and click on New alert rule, please have a look at the following snapshot:
    Mustafa_Ashour_8-1622214935406.png

     





  9. An alert will be created using the above query, please have a look at the followings snapshot:
    Mustafa_Ashour_9-1622214935442.png

     





  10. Click on the condition that you want to add the threshold in, please have a look at the following snapshot:
    Mustafa_Ashour_10-1622214935413.png

     



  11. Enter a specific threshold in the Threshold value field, then click Done, please have a look at the followings snapshot:
    Mustafa_Ashour_11-1622214935410.jpeg

     





  12. In Customize Actions section, select the Email subject and enter your specific email, please have a look at the following snapshot:
    Mustafa_Ashour_12-1622214936057.png

     



  13. In Alert Details section, fill alert rule name and description and finally click on Create alert rule button, please have a look at the following snapshot:Mustafa_Ashour_13-1622214935381.png

     





  14. To check if the alert created, from the portal search for Alerts then manage alerts, and you will find your created alert, please have a look at the following snapshot:
    Mustafa_Ashour_14-1622214935469.png

     




 


More information can be found in the following documents:


Mustafa_Ashour_15-1622214935276.png Tutorial: Get started with Log Analytics queries
Mustafa_Ashour_16-1622214935277.png Get started with log queries in Azure Monitor

Brought to you by Dr. Ware, Microsoft Office 365 Silver Partner, Charleston SC.