Create Custom .NET Azure Site Extension Packages

You can add more monitoring of your .NET applications on Azure by creating custom Azure Site Extension packages.
apmdevops106
You can add more monitoring of your .NET applications on Azure by creating custom Azure Site Extension packages.
2
2
Create a Custom Site Extension by Configuring and Repackage an Existing Site Extension
You can create a .NET agent Azure App Services custom extension by downloading, configuring, and repackaging the CA APM site extension.
This topic includes an example in which you create a .NET Agent extension that bundles a custom agent extension into a site extension. Azure loads the example site extension in addition to loading the existing .NET agent.
You can install multiple instances of new site extension bundles with the .NET agent.
Follow these steps to create the example site extension:
  1. Log in to Microsoft Azure, navigate to
    Advanced Tools
    ,
    Debug Console
    ,
    PowerShell
    .
  2. Open PowerShell, and select
    SiteExtensions
    .
  3. Select
    APM .NET Agent for Azure App Services
    from the list of available extensions.
  4. Click the
    Download icon
    to the left of the
    Wily
    folder.
  5. Download and extract the dotnet-agent-<release>-dotnet-azure-profile-extension.zip file.
    This file contains batch scripts for creating custom site extensions.
  6. (Optional) Configure the package metadata.
    1. Navigate to the <Agent_Home>/repackage directory.
    2. Open the APM.NET.Azure.AppServices.Extension.nuspec.txt file in a text editor.
    3. Update the
      id
      ,
      title,
      and
      authors
      fields as shown in this example:
      <?Xml version="1.0" encoding="utf-8" ?>
      <package>
      <metadata>
      <id>Custom.APM..NET.Azure.Extension.#1</id>
      <version>00.00.0.1</version>
      <title>Custom APM .NET Azure Extension #1</title>
      <authors>.NET Team</authors>
  7. Create the extensions folder and add the .NET agent files.
    1. Navigate to the <Agent_Home> directory and create an extensions sub-directory
    2. Open the extensions directory and create a sub-directory that is named for the extension.
      For example, Custom APM .NET Azure Extension #1.
    3. Open the <Extension_Name> directory, and create a directives sub-directory.
    4. Add the <Extension_Name>.pbd to the directives directory.
      For example, Custom_APM_.NET_Azure_Extension_#1.pbd.
    5. Create a lib sub-directory under the <Extension_Name> directory.
    6. Add the <Extension_Name>.dll to lib sub-directory.
  8. Run the repackage script.
    1. Navigate to the <Agent_Home>/repackage directory.
    2. Run package-extension.bat.
  9. (Optional) Upload the extension to a third-party nuget repository such as myget.org.
    For this step, we use myget.org as an example repository.
    1. Navigate to myget.org and create an account.
    2. Create a feed to host the agent extension.
      For example, your feed URL could be www.myget.org/F/our_.net_azure_extensions.
    3. Open the feed and click
      Add package
      , then click
      NuGet package
      .
    4. Click the
      Feed details
      .
    5. Copy the URL from the
      NuGet V3
      field.
      For example, https://www.myget.org/F/our_.net_azure_extensions/api/v3/index.json.
  10. Configure the feed in Azure and Install the agent extension.
    1. Log in to Microsoft Azure, navigate to
      Application Settings
      .
    2. Add an
      SCM_SITEEXTENSIONS_FEED_URL
      property.
    3. Past the URL from the
      NuGet V3
      field as the
      SCM_SITEEXTENSIONS_FEED_URL
      property value.
    4. Open
      Extensions
      and click
      Add
      .
    5. Select the agent extension and install.
    6. Restart the app service containers.
      The new .Net agent site extension monitor more aspects of .NET applications running on Azure.
Create a .NET Site Extension Using the Agent Profile
You might not want to create a custom .NET Azure App Services site extension using Azure Application Settings. In this case, you can create a .NET Azure Site Extension by configuring the .NET agent profile. An agent-profile-based extension bundles all of the .NET agent configuration files, and overrides any files in the <Agent_Home> directory.
Follow these steps:
  1. Log in to Microsoft Azure, navigate to
    Advanced Tools
    ,
    Debug Console
    ,
    PowerShell
    .
  2. Open PowerShell, and select
    SiteExtensions
    .
  3. Select
    APM .NET Agent for Azure App Services
    from the list of available extensions.
  4. Click the
    Download icon
    to the left of the
    Wily
    folder.
  5. Download and extract the dotnet-agent-<release>-dotnet-azure-profile-extension.zip file.
    This file contains batch scripts for creating custom site extensions.
  6. Navigate to the <.Agent_Home> directory.
  7. Open the .NET IntroscopeAgent.profile file and configure the appropriate properties.
  8. Navigate to the <Agent_Home>/ext directory.
  9. Add DLL files to or remove DLL files from the ext folder.
  10. Navigate to the <.Agent_Home>/repackage directory, and run the package-profile.bat file command.
    The nupkg file is created in the target folder.
  11. (Optional) Upload the extension to a third-party nuget repository such asmyget.org.
    For this step, we use myget.org as an example repository.
    1. Navigate to myget.org and create an account.
    2. Create a feed to host the agent extension.
      For example, your feed URL could be www.myget.org/F/our_.net_azure_extensions.
    3. Open the feed and click
      Add package
      , then click
      NuGet package
      .
    4. Click the
      Feed details
      .
    5. Copy the URL from the
      NuGet V3
      field.
      For example, https://www.myget.org/F/our_.net_azure_extensions/api/v3/index.json.
  12. Configure the feed in Azure and Install the agent extension.
    1. Log in to Microsoft Azure, navigate to
      Application Settings
      .
    2. Add an
      SCM_SITEEXTENSIONS_FEED_URL
      property.
    3. Past the URL from the
      NuGet V3
      field as the
      SCM_SITEEXTENSIONS_FEED_URL
      property value.
    4. Open
      Extensions
      and click
      Add
      .
    5. Select the agent extension and install.
    6. Restart the app service containers.
      The new .Net agent site extension monitor more aspects of .NET applications running on Azure.
.NET Agent Metrics
When .NET Agent detects a value for Service Plan in an Azure instance, it reports these metrics:
  • Agent Stats | Cloud: Service Plan
  • Agent Stats | Cloud: Service Provider
When .NET agent reports the Service Provider as Azure, the .NET agent also reports the Service Plan metric. The Service Plan metric values can be one of these values: Free, Shared, Basic, Standard, or Premium. These values correspond to the Azure pricing tiers, which are described on the Azure portal.
The Cores sustainability metric value is located here in the metric browser: Agent Stats, Sustainability, Compute Unit Metrics, Cores. To support .NET basic agent features, the reported memory is calculated as 2 GB per core when in an Azure environment with lowered system privileges. For example, an Azure App Service instance with four cores reports 8 GB of system memory.