Add a name for the build definition and select Hosted VS2017 as the Default agent queue.The repository and the branch are set automatically. Click on the Add Task button below and add the Nu Get Task.attribute where the client is instantiated by supplying the ZAP Url, port and the ZAP API Key.Next, we need to add methods to start spidering the web application and check the progress of spidering. Start Spidering() method is initiating a spider scan by supplying the ZAP API key and the target URL for the rest of the configuration options that are passed as parameters, pass empty strings.In the next dialog select MVC template and click Ok.I have Authentication set to Individual User Accounts. Next, add the unit test project by right clicking on the solution in the Solution Explorer and .Then add the following variables to the Test Class.The variables include API Key for OWASP ZAP, URL of the ZAP API, the port that the ZAP API is running on and the URL of the web application that needs to be tested. Next, we need to have the Client Api coming from the OWASP ZAP Nuget package which is used to access the ZAP API and the variable for the API response.
Check Spidering Progress() method does just that, the id of the spider scan is passed into the method and its used to query the progress of the scan and break out when the scan is done.
In the Nu Get task configuration options, select the restore as the command and click on the browse button and selecting the solution.
Then click on Add Task Button and add the Visual Studio Build task.
Click on Set up Build button to create a new Build Definition.
We’ll create the build definition from scratch, so click on the Empty process on the next screen to continue.