Install - .NET 3, 6, 7, 8 Agent on Containerized IIS App for Dynamic Analysis


Installation Steps

  1. Download the latest vFunction Windows Controller Installation ZIP
  2. Create a folder for vFunction artifacts in the Artifact Repository accessible by the Docker Build
  3. Add the vFunction Windows Controller Installation ZIP and the installation.yaml to the Artifact Repository
  4. Create a vFunction specific branch to add the vFunction artificats to the Application’s Dockerfile
  5. Modify the Application’s Dockerfile

FROM base_image_like_mcr.microsoft.com/dotnet/framework/aspnet
RUN existing_application_dockerfile_stuff

########### vFunction COPY Workflow ###########
### Replace ARTIFACT_REPOSITORY with the actual location
### Replace BASE_DIR with the desired location
COPY /ARTIFACT_REPOSITORY/vfunction-controller-windows-installation*.zip /BASE_DIR/vfunction-controller-windows-installation.zip

############ vFunction Environment Variables ############

### Modify the value to be this Application's Identifier for the VF Server UI, e.g. qa-container
ENV VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_NAME=CHANGE_ME

### Modify the value to be the URL of the vFunction Server
ENV VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_HOST=CHANGE_ME

### Gather this value from the vFunction Server UI's Learning > Select Controllers > Installation Instructions
ENV VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_ORG_ID=CHANGE_ME

### Gather this value from the vFunction Server UI's Learning > Select Controllers > Installation Instructions
ENV VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_APP_ID=CHANGE_ME

### Gather this value from the vFunction Server UI's Learning > Select Controllers > Installation Instructions
ENV VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_CLIENT_ID=CHANGE_ME

### Gather this value from the vFunction Server UI's Learning > Select Controllers > Installation Instructions
ENV VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_CLIENT_SECRET=CHANGE_ME

### Use a unique string for this value, e.g. Containerized, to help the vFunction Server manage when this Container goes up and down
ENV VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_INSTANCE_ID=CHANGE_ME

### Use Tags to organize Agents by functionality, environment or other logical groupings
ENV VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_TAGS="CHANGE_ME,CHANGE_ME"

# Unzip the Controller Installation ZIP
# This Dockerfile uses c:\vfunction as the location from which vFunction runs, find-and-replace this string if desired to run from a different location
RUN Expand-Archive -Path c:\BASE_DIR\vfunction-controller-windows-installation.zip -DestinationPath c:\vfunction -Force

# Set up vFunction's Controller, Viper to run as Processes but don't start those processes at Build Time
RUN powershell -NoProfile -ExecutionPolicy unrestricted -Command "c:\vfunction\controller-installation\install.ps1 -instance default-dotnet -scriptMode true -noServices true"

# Add Environmental Variables to the IIS App Pool
# If using a different App Pool besides DefaultAppPool, find-and-replace that string

RUN Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -filter "system.applicationHost/applicationPools/add[@name='DefaultAppPool']/environmentVariables" -name "." -value @{name='VF_AGENT_CONF_LOCATION';value='c:\vfunction\config\agent\instances\default-dotnet\conf.json'} 
RUN Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -filter "system.applicationHost/applicationPools/add[@name='DefaultAppPool']/environmentVariables" -name "." -value @{name='CORECLR_PROFILER_PATH_64';value='c:\vfunction\agent\vfagent.net.dll'}  
RUN Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -filter "system.applicationHost/applicationPools/add[@name='DefaultAppPool']/environmentVariables" -name "." -value @{name='CORECLR_PROFILER_PATH_32';value='c:\vfunction\agent\vfagent.net.x86.dll'}
RUN Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -filter "system.applicationHost/applicationPools/add[@name='DefaultAppPool']/environmentVariables" -name "." -value @{name='CORECLR_ENABLE_PROFILING';value='1'}  
RUN Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -filter "system.applicationHost/applicationPools/add[@name='DefaultAppPool']/environmentVariables" -name "." -value @{name='CORECLR_PROFILER';value='{cd7d4b53-96c8-4552-9c11-6e41df8eab8a}'} 
RUN Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -filter "system.applicationHost/applicationPools/add[@name='DefaultAppPool']/environmentVariables" -name "." -value @{name='DOTNET_TailCallOpt';value='0'}  


ENTRYPOINT ["existing_startup_workflow"]

  1. Build and deploy the Application
  2. Confirm that the Application comes up and functions as expected
  3. If any issues arise: