You can use the Veracode Azure DevOps Extension to integrate Veracode Static Analysis into your Azure DevOps build pipelines.
Before you begin:
Before adding Veracode analysis to a build pipeline, you must meet these prerequisites:
Generated Veracode API credentials. If your credentials contain variables, you must start each variable with a
$and wrap the variable value in parentheses. For example, you enter the
The extension uses the variable names
VERACODE_API_KEY_SECRETfor the API credentials. If you use custom variables in your pipelines, ensure that none of your variable names conflict with these variable names for the API credentials.
Before uploading an application, you must package it to include the required debug symbols, as described in the packaging requirements.
If you want to upload multiple artifacts for scanning, you have prepared one or more ZIP archives:
a. Add the artifacts to one or more ZIP archives.
b. Ensure the ZIP archives are in the same upload file path location.
c. Prepare the ZIP archives for uploading to Veracode using a separate build step or build steps in your pipeline.
If you have an ASP.NET application, see the configuration instructions. The following .NET project includes an example precompilation step: https://github.com/veracode/verademo-dotnet/blob/main/azure-pipelines.yml.
To complete this task:
In your Azure DevOps project, select the Tasks tab and navigate to your build definition.
Select Add a task....
Search the list for the
Veracode Upload and Scantask. Then, select Add to add it to the build definition.
Select the Veracode Upload and scan task. The Veracode Upload and Scan window opens.
For Connection Details, select a connection source for connecting to Veracode:
- Service Connection: select an existing service connection that uses your Veracode API credentials or select New to create a new service connection. For a new connection, in the New service connection window, by default, the Server URL field is populated with the URL for accessing Veracode. Enter your Veracode API credentials, a name for the service connection and, then, click Save. The new connection is selected in the Select Service Connection dropdown menu.
- Credentials: enter your Veracode API credentials.
For Veracode Scan Settings, enter the name of the associated application profile, a unique scan name, and the filepath to the application artifact or the folder containing the artifacts to upload to Veracode.
If this is not an existing Veracode application, select the Create Application Profile checkbox in the Advanced Scan Settings section to have Veracode create an application profile.note
Application names in Azure DevOps are case-sensitive.
For Advanced Scan Settings:
- If you are using a development sandbox, enter a sandbox name or select Create Sandbox to create one.
- In the Optional Arguments field, enter any optional parameters to apply to the Upload and Scan action. For example, you can use the optional parameters to include and exclude files during the scan.
The following example specifies that the scan is of high importance, to include all DLL files, exclude all EXE files, scan in a sandbox named
mysandbox, which Veracode creates if the sandbox does not already exist, and to delete a scan with a status of incomplete, no modules defined, failed, or cancelled:
-criticality high -include *.dll -exclude *.exe -createsandbox true -sandboxname mysandbox -deleteIncompleteScan 1note
Do not enclose any of the values in single or double quotations.
You can hide a proxy password during the Upload and Scan action.
If the application profile does not exist, select the Create Application Profile checkbox to create it. You can select the Fail build if Upload and Scan build step fails checkbox to prevent the build from continuing if the Upload and Scan build step fails.
For Veracode Scan Results: select the Import Results upon Scan Completion checkbox to import the scan results. You can select the option under it to stop the build if the scan results indicate that the application has failed your security policy.
Selecting either checkbox reserves an assigned build agent to wait until the scan has completed successfully and the scan results are available. With one or both checkboxes selected, you can enter the build agent wait time, in minutes, for failing the build if no scan results are available. The value range is
1440(24 hours) and the default is
360(6 hours). If you enter a value outside this range, the build fails.
If neither checkbox is selected, the build agent uploads the binaries to Veracode and continues to the next build task in the task list.
Optionally, to add debugging to your pipeline, add a new variable and enter these values in the New variable window:
If you want to use the Veracode Azure DevOps flaw import feature in your build definition, configure the additional related build variables.
After the scan is complete, in your build definition, you can select the Veracode Scan Summary tab to view the scan results.