Share via


Configuring PaaS and SaaS monitoring from Operations Management Suite

In the previous article we published our Azure Web App which also had an Azure SQL Database backend. Now we want to move onto the important business of monitoring it.

Out of the box, Azure does provide some metrics. You can see them if you log into the Azure portal and are described here for Web Apps and here for Azure SQL Database.

azureresourcemetrics_web

But this only allows for short term data retention and limited customisations of the dashboards, even with the ability to pin tiles to new dashboards.

For longer term data retention but also to improve correlation and data analysis, this data can be pulled into OMS following the guidelines here and a script from the gallery here. I'll run through it for the Azure Web App and the Azure SQL Database that we created earlier. I will just enable Azure Metrics on the Resource Group we have created although you could enable for the whole subscription; the link gives all the details.

  • Open an elevated PowerShell command prompt and
  • Install the latest AzureRM modulesinstall-module -Name AzureRM (enter y at prompt - you may get an error if modules are already installed.)
  • Save the Enable-AzureRMDiagnostics.ps1 script locallysave-script -Name Enable-AzureRMDiagnostics -Path "C:\Temp"
  • Change path to c:\temp and execute the script.\Enable-AzureRMDiagnostics.ps1 -ResourceGroup rg-contosouni-gd  (Note - you will need to change this to the name of your resource group that contains the Azure Web App and Azure SQL DB)
  • You will need to run through the wizard once and select for the Azure Web App:
    • Subscription
    • Log Analytics Workspace
    • Resource Type ==> Microsoft.Web/sites
  • You will need to re-run the script and go through the wizard and select for the Azure SQL DB:
    • Subscription
    • Log Analytics Workspace
    • Resource Type ==> Microsoft.Sql/servers/databases
  • Now go to the OMS Solutions Gallery (through the OMS portal) or the Azure market place (through the Azure portal) and add:
    • Azure Web Apps Analytics
    • Azure SQL Analytics
    Azure Web Apps Analytics Azure SQL Analytics
  • In about 15 minutes you should start to get metrics

If you need to onboard PaaS and SaaS resources that are in a different subscription from your log analytics workspace then you can run the script and pass it parameters

  • .\Enable-AzureRMDiagnostics.ps1 -WSID "/subscriptions/fd2323a9-2324-4d2a-90f6-7e6c2fe03512/resourceGroups/OI-EAST-USE/providers/Microsoft.OperationalInsights/workspaces/OMSWS" -SubscriptionId "fd2323a9-2324-4d2a-90f6-7e6c2fe03512" -ResourceType "Microsoft.Sql/servers/databases" -ResourceGroup "RGName" -Force

The above command line will take in parameters and execute silently without prompting using Force.