Azure DevOps Integration

The Cloud Security Azure DevOps integration helps your security and development teams integrate infrastructure-as-code (IaC) security and compliance scans (serviced using the CLI IaC Scanning Tool mimics) with Azure Pipelines and Boards. Setting up this integration is as simple as copying a YAML file to your code repository!

Prerequisites

  • Cloud Security Domain Admin permissions
HTML viewer extension recommended

Though it’s not required, Cloud Security highly recommends including a third-party HTML viewer extension as part of your Azure DevOps organization as it can improve the IaC output and pipeline artifacts viewing experience.

Integrate with Azure Pipelines

To integrate the Cloud Security CLI IaC Scanning Tool (mimics) with Azure Pipelines, you’ll need to incorporate one of the example YAML files included in the following sections into your code repository. The file you use depends on how you are currently using mimics. Currently, Cloud Security supports running mimics as an executable or using Docker.

In each example YAML file, we have included the following Azure Pipeline environment variables to keep sensitive data secure and interact with Cloud Security and AWS Elastic Container Registry (ECR) if applicable:

  • BASE_URL - The web address of your Cloud Security environment, which can be found in System Settings.
  • ICS_API_KEY - An API Key used to access Cloud Security data without traditional username-password authentication
    • We recommend this value remains a secret within Azure DevOps
  • IAC_TEMPLATE_DIR_PATH - The file path to the directory that contains your IaC templates (relative to the project root). For example, /path/to/cloudformation.
  • IAC_CONFIG_NAME - The name of the IaC Configuration to run the scan against
    • If your configuration name contains spaces, you will need to wrap the environment variable value in quotation marks. For example, "Test Configuration".

For more information on Azure Pipelines variables, review Define Variables.

Planning on storing sensitive information within Azure DevOps environment variables?

Azure DevOps environment variables can be stored as secrets to not expose any sensitive information, such as API or access keys. When configuring environment variables for your Azure Pipeline, ensure that sensitive data is not exposed by selecting the Keep this a secret checkbox when inputting variables.

Run as an executable

The CLI IaC Scanning Tool can be run as an executable using Terraform or Amazon Web Services’ (AWS) CloudFormation.

Run using Docker

The CLI IaC Scanning Tool can also be run as a Docker container using Terraform or AWS CloudFormation, but requires additional configuration. To run mimics in a Docker container, you’ll need to provide the following variables to authenticate for the AWS CLI so Cloud Security can retrieve the mimics container image from AWS Elastic Container Registry (ECR):

  • AWS_ACCESS_KEY_ID - The ID of the Access Key associated with an IAM User to enable programmatic requests
  • AWS_SECRET_ACCESS_KEY - The secret value of the Access Key

To view all publicly-available mimics container images, visit the Rapid7 ECR Gallery. For more information on AWS Access Keys and long-term credentials, review Managing access keys for IAM users.

AWS authentication should be stored as a secret

Both variables should be stored as secrets within your Azure DevOps Pipeline.

Integrate with Azure Boards (optional)

To integrate the Cloud Security CLI IaC Scanning Tool (mimics) with Azure Boards, you’ll need to follow the instructions for integrating Azure Pipelines first and then incorporate the example in this section with the appropriate YAML file for your setup. In the following example YAML section, we have included the following environment variables to assist your new Cloud Security Azure Pipelines integration in interacting with Azure Boards:

  • PAT - A Personal Access Token (PAT) for your Azure DevOps user, which helps pipelines create work items for each finding produced by the IaC analysis scans.
    • PATs should be stored as a secret within your Azure DevOps environment variables. For more information on PATs, visit Use Personal Access Tokens.
  • AZURE_BOARDS_ORGANIZATION - The Azure DevOps Organization where the Azure Board work items should be placed.
  • AZURE_BOARDS_PROJECT - The Azure DevOps Project where Azure Board work items should be placed.

Create an Azure Pipeline

After you have selected the appropriate example YAML file for your project and copied it to the code repository, you are ready to set up the integration in Azure Pipelines.

Something not quite right?

For the most up-to-date information, refer to Microsoft Azure’s documentation on creating an Azure Pipeline.
  1. Log in to the Azure Console.
  2. Navigate to Azure Pipelines.
  3. Click New Pipeline.
  4. In the Connect section, follow the steps to connect and select the host of your code repository.
  5. In the Configure section, click Starter Pipeline.
  6. Copy and paste the example YAML file you selected in the Integrate with Azure Pipelines over the existing YAML on this page.
  7. Click Variables and provide the applicable environment variables.
  8. Validate the YAML and update as necessary. For example, setting pipeline triggers and a valid Terraform version.
  9. Click Run > Save.