Agent installation guide
Overview
This guide offers examples for using Contrast Security’s .NET Framework and .NET Core agents with ARM templates. We encourage you to take this guide, make it your own, and distribute it to teams who need to instrument applications this way.
The main portion of the guide details the most popular methods customers use to instrument .NET Framework and Core applications through automation with ARM templates and Azure.
Main steps
-
Update application ARM template
- Add the Contrast agent extension
- Add Contrast agent configuration options in the siteConfig section
- Deploy your application with an updated ARM template
Supported technologies
Before you begin, please be sure Contrast supports your preferred tools and environments for the .NET Framework or .NET Core agents:
Supported technologies for .NET Framework
Supported technologies for .NET Core
This guide assumes you have:
- Some familiarity with DevOps practices and how the Azure Portal works
-
The information and access you need to install .NET agents for Contrast:
Install the .NET Framework agent
Install the .NET Core agent
Known issues
- You can only configure site extensions either directly through the Azure Portal with an ARM policy or through Azure’s REST API. All methods described in this document use one of these methods. Only REST API and Azure ARM policies allow for automated deployments.
- You should only configure a Contrast site extension with backend HTTP services and not WebJobs or UI app services.
- The methods described here do not work if you are deploying an App service using Docker.
Instructions
Begin by updating the application ARM template.
1) Add Contrast configuration values
You can download the agent configuration values directly from Contrast. Begin by selecting Add Agent in Contrast and complete the steps indicated to get the values. You must edit the values highlighted in the sample ARM template below. For more details, check Contrast documentation:
Contrast agent for .NET Core
{ |
Contrast agent for .NET Framework
{ |
Contrast API access configuration
To automate your ARM templates more fully, you need access to Contrast API credentials, either from the contrast_security.yml file and agent you can download from Contrast (as described above) or from Organization Settings on the API page.
You will need to note the values below, either from the Contrast UI or from your contrast_security.yaml file:
Configuration setting name Contrast label
CONTRAST__API__API_KEY
API Key
CONTRAST__API__URL Contrast
URL
CONTRAST__API__USER_NAME
Agent Username
CONTRAST__API__SERVICE_KEY
Agent Service Key
2) Deploy your application using an ARM template.
You can deploy your application from the ARM template in the following methods from the Azure documentation:
- In the command line or CLI: https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/deploy-cli
- Azure Portal: https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/quickstart-create-templates-use-the-portal#edit-and-deploy-the-template
Begin by adding authentication details to configuration for the Contrast agent.
FAQ
1. Where can I find logs if I don’t see my application in Contrast after I deploy my template?
There can be multiple reason application is not listed:
-
Contrast is failing to attach to the application process or communicate to the team server. You can find the logs using Kudu services in this location:
D:\home\LogFiles\Contrast - You don’t have permission to the group you configured in application configuration. For this, reach out to your Contrast administrator.