Lesson 3 of 6 Security and Compliance Scanning

Configuring Microsoft Defender for Cloud DevOps Security

This lesson explains central DevOps posture, connectors and Microsoft Security DevOps.

Learning outcomes

After completing this lesson, you will be able to:

  • Explain what DevOps security provides.
  • Describe how platforms are connected.
  • Identify the tools in Microsoft Security DevOps.
  • Run the task and the action.

What DevOps security provides

Microsoft Defender for Cloud is Azure's cloud security posture and workload protection service. Its DevOps security capability extends that view to the development environment. Whereas GitHub Advanced Security helps a developer to fix code in one repository, Defender for Cloud gives a security team a central picture across Azure DevOps, GitHub and GitLab: which repositories have exposed secrets, vulnerable dependencies, code flaws and insecure IaC, and which have weak settings, such as no branch protection.

Foundational visibility is available when an environment is connected, and advanced features such as attack path analysis and code-to-cloud contextual mapping need the Defender Cloud Security Posture Management (Defender CSPM) plan.

True or false

What Defender for Cloud DevOps security gives

Exam skills 4.3.2

Check what DevOps security in Defender for Cloud provides and what it needs.

Log in to try this activity Interactive activities are free with an account.

Connecting environments

Platforms are connected through connectors. The following sequence applies to each platform.

  1. Open the console

    In Defender for Cloud, open DevOps security, or Environment settings.

  2. Add an environment

    Choose Azure DevOps, GitHub or GitLab, and create a connector in a subscription.

  3. Authorize

    Grant access to organizations and repositories, which needs admin rights on the platform.

  4. Review findings

    Repositories and their findings appear in the DevOps security console.

  5. Configure annotations

    Enable pull request annotations for chosen severity levels.

After connection, the console shows an inventory and recommendations. A pull request annotation reports IaC and other findings directly to a developer, inside the pull request.

The following diagram shows GitHub and Azure DevOps feeding one security console in Microsoft Defender for Cloud.

One security view across GitHub and Azure DevOps. DevOps security connectors link both platforms to Microsoft Defender for Cloud, whose console shows exposed secrets and IaC weaknesses together, with no change to developers' workflows. Each platform's own view covers only that platform.
The scenario is illustrative.
Put in order

Connecting a DevOps platform

Exam skills 4.3.2

Arrange the steps for connecting a platform to Defender for Cloud.

Log in to try this activity Interactive activities are free with an account.

Microsoft Security DevOps

Microsoft Security DevOps (MSDO) is a command-line application that runs open-source and Microsoft static analysis tools, and is packaged for pipelines. It sends results in SARIF format. The tools include the following.

ToolScans
BanditPython code
ESLintJavaScript code
BinSkimCompiled binaries
CheckovIaC, including Bicep, ARM and Terraform
Template AnalyzerARM and Bicep templates
TerrascanIaC, including Terraform and Kubernetes
TrivyContainer images and file systems
AntiMalwareMalware, on Windows agents

In Azure Pipelines, the extension is installed from the Marketplace, which needs Project Collection Administrator rights, and it adds the MicrosoftSecurityDevOps@1 task.

steps:
  - task: MicrosoftSecurityDevOps@1
    displayName: Run Microsoft Security DevOps
    inputs:
      categories: IaC,containers
      break: true

  # Third-party SARIF results reach Defender for Cloud through this artifact name
  - task: PublishBuildArtifacts@1
    inputs:
      PathtoPublish: $(Build.ArtifactStagingDirectory)/results
      ArtifactName: CodeAnalysisLogs

The artifact name CodeAnalysisLogs matters, since Defender for Cloud reads results from it. On GitHub, the microsoft/security-devops-action action does the same job, and it can upload SARIF to the Security tab, which needs security-events: write.

permissions:
  contents: read
  id-token: write
  actions: read
  security-events: write

jobs:
  scan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: microsoft/security-devops-action@latest
        id: msdo
      - uses: github/codeql-action/upload-sarif@v3
        with:
          sarif_file: ${{ steps.msdo.outputs.sarifFile }}

One tool has changed: the CredScan secret scanner in MSDO for Azure DevOps was deprecated on 20 September 2023, and GitHub Advanced Security for Azure DevOps replaced it. Do not choose MSDO for secret scanning.

Match the pairs

Tools inside Microsoft Security DevOps

Exam skills 4.3.2

Match each MSDO tool with what it scans.

Log in to try this activity Interactive activities are free with an account.
Worked example

One view across platforms

A company uses GitHub for some teams and Azure DevOps for others. Its central security team wants one place to see exposed secrets and IaC weaknesses across both, and it does not want to change developers' workflows. What should you recommend?

Connect both platforms to Microsoft Defender for Cloud through DevOps security connectors, and review findings in the console. Moving all code to one platform would be disruptive, and is not needed. The GitHub security overview covers only GitHub, and the Azure DevOps Advanced Security view covers only Azure DevOps, so neither gives a single view.

Check yourself

Why should you avoid MSDO for secret scanning?

Show answer

Its CredScan tool was deprecated in 2023, and GitHub Advanced Security for Azure DevOps replaced it.

Exam Tips

Remember for the exam

  • DevOps security gives one view across Azure DevOps, GitHub and GitLab.
  • Platforms connect through connectors in Defender for Cloud.
  • Advanced context needs the Defender CSPM plan.
  • MSDO runs Bandit, Checkov, Trivy, Terrascan and similar tools.
  • SARIF results for Defender for Cloud use the CodeAnalysisLogs artifact name.