Install - .NET Agent Controller on Azure App Services for Dynamic Analysis



Overview

The vFunction Dynamic Analysis Controller can be configured for a manual or automatic installation.

In a manual installation, the vFunction Dynamic Analysis Controller is always staged. But, it it only running when an Administrator runs the installation script in the Azure App Services Console. This means that, if a new version of the Application is deployed to Azure App Services or if the Application is restarted, the vFunction Dynamic Analysis Controller will need to be manually installed again.

In an automatic installation, the vFunction Controller process is added to the repository of the Application. As part of the Application’s startup process in Azure App Services, the vFunction Dynamic Analysis Controller is launched when the Application is deployed. This means that the vFunction Dynamic Analysis Controller will always be running with the Application in Azure App Services.


Manual Installation

Installation Workflow
  1. Download the vFunction Controller Windows Installation ZIP
  2. Open the App from the Azure Portal
  3. From the left-hand sidebar, open the Development Tools > Advanced Tools > Go to launch the Kudu Console
  4. On the Menu Bar, open the Debug Console > PowerShell editor
  5. Drag-and-drop the vFunction Controller Windows Installation ZIP into C:\home\
  6. Unzip the Installation ZIP, for example:
Expand-Archive -Path C:\home\vfunction-controller-windows-installation.v3.8.1527.zip -DestinationPath C:\home -Force
  1. In the Kudu Menu Bar, go to Process Explorer and select the Properties button for the w3wp.exe process. Look for the quote-enclosed string after the flag -ap. Copy-and-paste this value into a text editor for use in a later step. The value may start with unexpected characters such as “~1”

  2. The full path to the w3wp.exe process dictates whether this is a 32-bit or 64-bit, e.g. C:\Windows\System32 or C:\Windows\SysWOW64. Note whether this is a 32-bit or 64-bit w3wp.exe process for use in a later step.

  3. In the Kudu Menu Bar, go to Debug Console > PowerShell. Navigate to and edit the

    C:\home\vfunction\config\installation\instances\default-dotnet\installation.yaml

  4. In the installation.yaml, set the required values

  5. In the installation.yaml, uncomment the agent.application_name. Add the string from Step #7 as the value here

  6. Uncomment the agent.architecture and set the value:

  • x86 = C:\Windows\System32
  • x64 = C:\Windows\SysWOW64
  1. Save and close the installation.yaml
  2. In PowerShell, set the Installation Files without starting the vFunction Processes
powershell -NoProfile -ExecutionPolicy unrestricted -Command "C:\home\vfunction\controller-installation\install.ps1 -instance default-dotnet -agentMode true -runAsServices false -scriptMode true -noServices true" 
  1. Re-open the App from the Azure Portal
  2. From the left-hand sidebar, select Settings > Environment Variables
  3. Add six new Environment Variables based on the .NET version
.NET Core 3.x and .NET 6 / 7 / 8 Applications
Key Value
CORECLR_ENABLE_PROFILING 1
DOTNET_TailCallOpt 0
CORECLR_PROFILER {cd7d4b53-96c8-4552-9c11-6e41df8eab8a}
CORECLR_PROFILER_PATH_32 C:\home\vfunction\agent\vfagent.net.x86.dll
CORECLR_PROFILER_PATH_64 C:\home\vfunction\agent\vfagent.net.dll
VF_AGENT_CONF_LOCATION C:\home\vfunction\config\agent\instances\default-dotnet\conf.json
.NET Framework 4.x Applications
Key Value
COR_ENABLE_PROFILING 1
COMPlus_TailCallOpt 0
COR_PROFILER {cd7d4b53-96c8-4552-9c11-6e41df8eab8a}
COR_PROFILER_PATH_32 C:\home\vfunction\agent\vfagent.net.x86.dll
COR_PROFILER_PATH_64 C:\home\vfunction\agent\vfagent.net.dll
VF_AGENT_CONF_LOCATION C:\home\vfunction\config\agent\instances\default-dotnet\conf.json
  1. Save and apply the Environment Variable changes. This will automatically restart the Azure App Service’s instance
  2. Re-open the Kudu PowerShell Console
  3. Start the vFunction processes
powershell -NoProfile -ExecutionPolicy unrestricted -Command "C:\home\vfunction\controller-installation\restart-controller.ps1 -instance default-dotnet" 
  1. In the vFunction Server UI, confirm that the Agent is Status: Up and Start Learning
  2. If any issues arise:

Automatic Installation

Notes

The installation workflow below will require you to update the deploy.cmd if you do not want to use the default locations. You would want to do this if:

  • You want to use a different directory than ROOT/vfunction-stuff as the location for the vFunction Configuration Files
  • You want to use a different directory than ROOT/wwwroot as the vFunction Installation location

Installation Workflow
  1. Ensure prerequisites are met
  2. Download the vFunction Controller Windows Installation ZIP
  3. Rename this ZIP to be 'vfunction-controller-windows-installation.zip'
  4. Download the vFunction Azure App Services Sample Installation Guide
  5. Untar the vFunction Azure App Services Sample Installation Guide

    tar xvf 'Installing vFunction Controller on Azure App Services_Version-2.tgz'
  6. Open the vfunction-controller-in-application-azure-app-services/config/installation.yaml in a text editor
  7. Modify the required settings as well as the instance_id and application_name
  8. Log into the Azure App Services Portal
  9. Navigate to the Application's Configuration > Application Settings
  10. Create six new Application Settings

    .NET Core 3.x and .NET 6 / 7 / 8 Applications
    • CORECLR_ENABLE_PROFILING = 1
    • DOTNET_TailCallOpt = 0
    • CORECLR_PROFILER = {cd7d4b53-96c8-4552-9c11-6e41df8eab8a}
    • CORECLR_PROFILER_PATH_32 = C:\\home\\vfunction\\agent\\vfagent.net.x86.dll
    • CORECLR_PROFILER_PATH_64 = C:\\home\\vfunction\\agent\\vfagent.net.dll
    • VF_AGENT_CONF_LOCATION = C:\\home\\vfunction\\config\\agent\\instances\\default-dotnet\\conf.json
    .NET Framework 4.x Applications
    • COR_ENABLE_PROFILING = 1
    • COMPlus_TailCallOpt = 0
    • COR_PROFILER = {cd7d4b53-96c8-4552-9c11-6e41df8eab8a}
    • COR_PROFILER_PATH_32 = C:\\home\\vfunction\\agent\\vfagent.net.x86.dll
    • COR_PROFILER_PATH_64 = C:\\home\\vfunction\\agent\\vfagent.net.dll
    • VF_AGENT_CONF_LOCATION = C:\\home\\vfunction\\config\\agent\\instances\\default-dotnet\\conf.json
  11. Save the Application Settings and wait for the Application to restart
  12. Open your project's root directory for the Application in your code editor of choice
  13. Copy the following files into the project's root directory:
    • vfunction-controller-in-application-azure-app-services/files/.deployment
    • vfunction-controller-in-application-azure-app-services/files/deploy.cmd
  14. Create a folder named 'vfunction-stuff' in the project's root directory
  15. Into the folder, upload the:
    • vfunction-controller-in-application-azure-app-services/config/installation.yaml
    • vfunction-controller-in-application-azure-app-services/config/global.yaml
    • vfunction-controller-windows-installation.zip
  16. Deploy your application to Azure App Services
  17. Confirm that the Application comes up and functions as expected
  18. If any issues arise: