Microsoft Azure App Service.apm-template

Prerequisites:

To connect with your Azure account, the following parameters are required:

     subcriptionID,ApplicationID,TenantID, Secret Key, Application Name

     Note: Azure App to monitor, with its name and ID, should have role set as 'contributor or Reader' in the Azure access control.

    2. Application name for which metrics will be calculated.

    3. Time interval for which data has to be fetched (in hours).

    4. PowerShell version supported 5.1 or above.

Script Argument:

  • Login credential to access Azure Portal. Azure details have to be passed in script arguments as per prerequisite #2.

             Example:

             <SubscriptionID>,<TenantID>,<ApplicationID>,secretKey=<Enter SecretKey>,<ApplicationName>,TimeRange=<Time in hrs>

  • The ApplicationID with which you are making a connection to the Azure portal (as mentioned in Credential/Prerequisites) must be registered in Azure Active Directory as a contributor role for the monitored application.

        Reference link: https://support.solarwinds.com/Success_Center/Server_Application_Monitor_(SAM)/Knowledgebase_Articles/Add_an_Azure_Active_Directory_app_for_cloud_monitoring_in_the_Orion_Platform

Portions of this document were originally created by and are excerpted from the following sources:

https://docs.microsoft.com/en-us/azure/app-service/web-sites-monitor  

https://docs.microsoft.com/en-us/powershell/azure/authenticate-azureps?view=azurermps-6.7.0

https://docs.microsoft.com/en-us/powershell/module/azurerm.insights/?view=azurermps-6.7.0&viewFallbackFrom=azurermps6.7.0#monitor

MONITORED COMPONENTS

  • Average number of bytes sent

      This monitor provides the average number of bytes sent for the given app.

      Unit: MB (Mega Bytes)

  • Total number of 2xx requests

      This monitor provides the count of requests resulting in an HTTP status code >= 200 but < 300 for the given app.

      Unit: Count

  • Total number of 3xx requests

      This monitor provides the count of requests resulting in an HTTP status code >= 300 but < 400 for the given app.

      Unit: Count

  • Total number of 401 requests

      This monitor provides the count of requests resulting in HTTP 401 status code for the given app.

      Unit: Count

  • Total number of 403 requests

      This monitor provides the count of requests resulting in HTTP 403 status code for the given app.

      Unit: Count

  • Total number of 404 requests

      This monitor provides the count of requests resulting in HTTP 404 status code for the given app.

      Unit: Count

  • Total number of 406 requests

      This monitor provides the count of requests resulting in HTTP 406 status code for the given app.

      Unit: Count

  • Total number of 4xx requests

      This monitor provides the count of requests resulting in an HTTP status code >= 400 but < 500 for the given app.

      Unit: Count

  • Total number of 5xx requests

      This monitor provides the count of requests resulting in an HTTP status code >= 500 but < 600 for the given app.

      Unit: Count

  • Total number of requests served by the app

      This monitor provides the total number of requests regardless of their resulting HTTP status code for the given app.

      Unit: Count

  • Average number of bytes received

      This monitor provides the average number of bytes received for the given app.

      Unit: MB (Mega Bytes)

  • Average memory used

      This monitor provides the average amount of memory in MBs used by the given app.

      Unit: MB (Mega Bytes)

  • Average response time

      This monitor provides the average time taken for the app to serve requests in milliseconds (ms).

      Unit: MS (Milliseconds)

TROUBLESHOOTING STEPS

Detailed troubleshooting steps (common for template):

Check that the PowerShell version is 5.1 or more and the Azure module is installed on the system where the template will run.

Template uses PowerShell components; script should run with administrator privilege.

Be sure to detail troubleshooting steps (specific for components).

Components connect with Azure using service principal authentication for which application has to be created at the Azure portal. See below link:

     https://docs.microsoft.com/en-us/azure/azure-stack/azure-stack-create-service-principals

Provide Azure IAM permission to the application, which was created in the last step. See below link:

     https://support.solarwinds.com/Success_Center/Server_Application_Monitor_(SAM)/Knowledgebase_Articles/Configure_Azure_IAM_permissions_for_cloud_monitoring_in_the_Orion_Platform

Script fetch data based on time range given in last script arguments. By default, script fetch data for the past hour. While giving the time range, make sure the data is available for the metric at that time, otherwise the component will be unable to fetch the data.

  • I was having problems with this template as well (even the latest one).  Had to do a couple things in order to get it to work.

      1) In the Get-AzureRMMetric command of the getAzureMetric function the -TimeGrain was hardcoded to 00:01:00

      2) In that same command the -MetricNames switch was changed to -MetricName

      3) had to include the ",value=<time in minutes>" argument  (in my case it looked like this "value=10" ) in the script arguments of the component.

    It also appears that as of Dec. 2018 there is a new powershell module that replaces AzureRM.  Supposed to be a bit easier to use

    Hopefully the other two Azure templates go smoother.

  • Also make sure that the "Secret Key" argument is actually input that way on the argument line:

    subcriptionID, ApplicationID , TenantID, SecretKey=xxxxxxxx, Application Name,TimeRange=1

  • Can you try adding one more argument: "TimeRange=1" to your parameters?

    Example:

    subcriptionID, ApplicationID , TenantID, Secret Key, Application Name,TimeRange=1

  • I have not got any reply. Would anyone else, please respond. I need to update the client asap. Thank you.

  • Hi jvb​,

    Thank you so much for the nice write up.

    I have downloaded the app service template (on 1/25/19) from the above and updated with all Application/Subscription/Tenant/IDs, Key, ApplicationName, TimeRange as 1. But, I have got the below error for all the components. I have created an external node as portal.azure.com and assigned to template as well. While testing, got the below error. Please help me asap. I need to get it worked, so that we would get more benefitted. I have raised case as well with Solarwinds and got the response to refer your article only emoticons_happy.png

    BTW, I have tested the credentials through Cloud Infrastructure Monitoring Settings by adding an account successfully.

    Output: ==============================================

    Account SubscriptionName TenantId Environment

    ------- ---------------- -------- -----------

    xxxxxxx-xxxx-xxxx-xxxx-6d12bb6a03da PROD xxxxxxxx-xxxx-xxxx-xxxx-c70dcacf2984 AzureCloud

    1

    [ERROR] Cannot validate argument on parameter 'ResourceId'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.

    Trying to reconnect..

    [ERROR] Cannot validate argument on parameter 'ResourceId'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.

    Trying to reconnect..

    [ERROR] Cannot validate argument on parameter 'ResourceId'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.

    Error while connecting

    =============================================================================

    I have selected None for Credentials for Monitoring from the component. Please advise asap.