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
- Download the vFunction Controller Windows Installation ZIP
- Open the App from the Azure Portal
- From the left-hand sidebar, open the Development Tools > Advanced Tools > Go to launch the Kudu Console
- On the Menu Bar, open the Debug Console > PowerShell editor
- Drag-and-drop the vFunction Controller Windows Installation ZIP into
C:\home\
- Unzip the Installation ZIP, for example:
Expand-Archive -Path C:\home\vfunction-controller-windows-installation.v3.8.1527.zip -DestinationPath C:\home -Force
-
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”
-
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.
-
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
-
In the installation.yaml, set the required values
-
In the installation.yaml, uncomment the agent.application_name. Add the string from Step #7 as the value here
-
Uncomment the agent.architecture and set the value:
- x86 = C:\Windows\System32
- x64 = C:\Windows\SysWOW64
- Save and close the installation.yaml
- 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"
- Re-open the App from the Azure Portal
- From the left-hand sidebar, select Settings > Environment Variables
- 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 |
- Save and apply the Environment Variable changes. This will automatically restart the Azure App Service’s instance
- Re-open the Kudu PowerShell Console
- Start the vFunction processes
powershell -NoProfile -ExecutionPolicy unrestricted -Command "C:\home\vfunction\controller-installation\restart-controller.ps1 -instance default-dotnet"
- In the vFunction Server UI, confirm that the Agent is Status: Up and Start Learning
- 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
- Ensure prerequisites are met
- Download the vFunction Controller Windows Installation ZIP
- Rename this ZIP to be 'vfunction-controller-windows-installation.zip'
- Download the vFunction Azure App Services Sample Installation Guide
- Untar the vFunction Azure App Services Sample Installation Guide
tar xvf 'Installing vFunction Controller on Azure App Services_Version-2.tgz'
- Open the vfunction-controller-in-application-azure-app-services/config/
installation.yaml
in a text editor - Modify the required settings as well as the instance_id and application_name
- Log into the Azure App Services Portal
- Navigate to the Application's Configuration > Application Settings
- 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
- Save the Application Settings and wait for the Application to restart
- Open your project's root directory for the Application in your code editor of choice
- 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
- vfunction-controller-in-application-azure-app-services/files/
- Create a folder named 'vfunction-stuff' in the project's root directory
- 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
- vfunction-controller-in-application-azure-app-services/config/
- Deploy your application to Azure App Services
- Confirm that the Application comes up and functions as expected
- If any issues arise: