The following instructions explain how to deploy the .NET microservices agent for AppDynamics for Azure Service Fabric.

Before you Install

From nuget.org, download the NuGet package AppDynamics.Agent.Distrib.Micro.Windows from https://www.nuget.org/packages/AppDynamics.Agent.Distrib.Micro.Windows/, then extract it to a folder. Then, use the following instructions to deploy the agent package.

Choose a procedure below to match your environment:

Deploy the Package using Visual Studio

  1. From your editor, open ServiceManifest.xml in each folder in the published application root.
  2. Add the following environment variables in each CodePackage:

    <CodePackage ...>
      <EntryPoint>
        ...
      </EntryPoint>
      <EnvironmentVariables>
        <EnvironmentVariable Name="COR_ENABLE_PROFILING" Value="1" />
        <EnvironmentVariable Name="COR_PROFILER" Value="{39AEABC1-56A5-405F-B8E7-C3668490DB4A}" />
        <EnvironmentVariable Name="COR_PROFILER_PATH" Value="<PathToDeploymentFolder>/AppDynamics.Profiler_x64.dll" />
      </EnvironmentVariables>
    </CodePackage>
    XML
  3. Make a copy of the AppDynamicsConfig.json file and rename it to <executable_name>.AppDynamicsConfig.json. For example, <servicefabricapplicationname>.AppDynamicsConfig.json.

    When you rename the .json file to the application name, do not include .exe at the end of your application name.

  4. Copy AppDynamics.Agent.dllAppDynamics.Profiler_x64.dllAppDynamicsAgentLog.configAppDynamicsConfig.json from <nuget_package>\content\AppDynamics, then go to your Visual Studio solution "Solution Items" subfolder. 

  5. Right-click on the AppDynamics related files and select Copy Always in Properties.

  6. Update <executable_name>.AppDynamicsConfig.json with your configuration information:

    {
     "controller":
     {
     "host":"",
     "port":0,
     "account":"",
     "password":""
     },
     "application":
     {
     "name":""
     }
    }
    JSON

Do not specify node; it will be assigned automatically; Specifying tier is optional, it could be assigned automatically.

The next steps are optional and should only be used if you need per service-instance control of the controller/application/tier.

  1. Add the following environment variables to each CodePackage:

    <EnvironmentVariable Name="appdynamics.controller.hostName" Value="< >" />
    <EnvironmentVariable Name="appdynamics.controller.port" Value="<  >" />
    <EnvironmentVariable Name="appdynamics.agent.accountName" Value="<  >" />
    <EnvironmentVariable Name="appdynamics.agent.accountAccessKey" Value="<  >" />
    <EnvironmentVariable Name="appdynamics.agent.applicationName" Value="<  >" />
    <EnvironmentVariable Name="appdynamics_agent_tier_name" Value="<  >" />
    XML



  2. Modify ApplicationManifest.xml. In each ServiceManifestImport and CodePackage folder add:
    • In ServiceManifestImport:

      <EnvironmentOverrides CodePackageRef="Code">
        <EnvironmentVariable Name="appdynamics.controller.hostName" Value="<AppD_ControllerHostName>" />
        <EnvironmentVariable Name="appdynamics.controller.port" Value="<AppD_ControllerPort>" />
        <EnvironmentVariable Name="appdynamics.agent.accountName" Value="<AppD_AccountName>" />
        <EnvironmentVariable Name="appdynamics.agent.accountAccessKey" Value="<AppD_AccountAccessKey>" />
        <EnvironmentVariable Name="appdynamics.agent.applicationName" Value="<AppD_ApplicationName>" />
        <EnvironmentVariable Name="appdynamics_agent_tier_name" Value="<AppD_Service_Name_TierName>" />
      </EnvironmentOverrides>
      XML
    • In Parameters:

      <Parameter Name="AppD_ControllerHostName" DefaultValue="<Your_Controller_Name>" />
      <Parameter Name="AppD_ControllerPort" DefaultValue="<Your_Controller_Port>" />
      <Parameter Name="AppD_AccountName" DefaultValue="<Your_Controller_Account_Name>" />
      <Parameter Name="AppD_AccountAccessKey" DefaultValue="<Your_Controller_Access_Key>" />
      <Parameter Name="AppD_ApplicationName" DefaultValue="<Your_Controller_App_Name>" />
      XML
    • For each service: <Parameter Name="AppD_%SERVICE_NAME%_TierName" DefaultValue="<Tier_Name_For_Service>" />
  3. If you need to provide the AppDynamics configuration during application package deployment, you can now do it using the  -ApplicationParameter switch of the New-ServiceFabricApplication cmdlet.

Deploy the Package using another IDE

  1. From your editor, open ServiceManifest.xml in each folder in the published application root.
  2. Add the following environment variables in each CodePackage:

    <CodePackage ...>
      <EntryPoint>
        ...
      </EntryPoint>
      <EnvironmentVariables>
        <EnvironmentVariable Name="COR_ENABLE_PROFILING" Value="1" />
        <EnvironmentVariable Name="COR_PROFILER" Value="{39AEABC1-56A5-405F-B8E7-C3668490DB4A}" />
        <EnvironmentVariable Name="COR_PROFILER_PATH" Value=AppDynamics/AppDynamics.Profiler_x64.dll" />
       </EnvironmentVariables>
    </CodePackage>
    XML
  3. Using PowerShell, unpack AppDynamics.Agent.dll, AppDynamics.Profiler_x64.dllAppDynamicsAgentLog.configAppDynamicsConfig.json from <nuget_package>\content\AppDynamics to the code package folder that contains the executable you want to run.

  4. Make a copy of the of the AppDynamicsConfig.json file and rename it to <executable_name>.AppDynamicsConfig.jsonFor example, <servicefabricapplicationname>.AppDynamicsConfig.json.

    When you rename the .json file to the application name, do not include .exe at the end of your application name.


  5. Update <executable_name>.AppDynamicsConfig.json with your configuration information:

    {
     "controller":
     {
       "host":"",
       "port":0,
       "account":"",
       "password":""
     },
     "application":
     {
     "name":""
     }
    }
    
    
    JSON

Do not specify the node; it will be assigned automatically.  Specifying the tier is optional; it could be assigned automatically.

The next steps are optional and should only be used if you need per service-instance control of the controller/application/tier.

  1. Add the following environment variables to each CodePackage:

    <EnvironmentVariable Name="appdynamics.controller.hostName" Value="" />
    <EnvironmentVariable Name="appdynamics.controller.port" Value="" />
    <EnvironmentVariable Name="appdynamics.agent.accountName" Value="" />
    <EnvironmentVariable Name="appdynamics.agent.accountAccessKey" Value="" />
    <EnvironmentVariable Name="appdynamics.agent.applicationName" Value="" />
    <EnvironmentVariable Name="appdynamics_agent_tier_name" Value="" />
    XML



  2. Modify ApplicationManifest.xml. In each ServiceManifestImport and CodePackage folder add:
    • In ServiceManifestImport:


      <EnvironmentOverrides CodePackageRef="Code">
        <EnvironmentVariable Name="appdynamics.controller.hostName" Value="<AppD_ControllerHostName>" />
        <EnvironmentVariable Name="appdynamics.controller.port" Value="<AppD_ControllerPort>" />
        <EnvironmentVariable Name="appdynamics.agent.accountName" Value="<AppD_AccountName>" />
        <EnvironmentVariable Name="appdynamics.agent.accountAccessKey" Value="<AppD_AccountAccessKey>" />
        <EnvironmentVariable Name="appdynamics.agent.applicationName" Value="<AppD_ApplicationName>" />
        <EnvironmentVariable Name="appdynamics_agent_tier_name" Value="<AppD_Service_Name_TierName>" />
      </EnvironmentOverrides>
      XML
    • In Parameters:

      <Parameter Name="AppD_ControllerHostName" DefaultValue="<Your_Controller>" />
      <Parameter Name="AppD_ControllerPort" DefaultValue="<Your_ControllerPORT>" />
      <Parameter Name="AppD_AccountName" DefaultValue="<Your_Controller_AccountName>" />
      <Parameter Name="AppD_AccountAccessKey" DefaultValue="<Your_Controller_AccessKey>" />
      <Parameter Name="AppD_ApplicationName" DefaultValue="<Your_Controller_App_Name>" />
      XML
    • For each service: <Parameter Name="<AppD_Service_Name_TierName>" DefaultValue="<Tier_Name_For_Service>" />
  3. If you need to provide the AppDynamics configuration during application package deployment, you can now do it using the  -ApplicationParameter switch of the New-ServiceFabricApplication cmdlet.