次の方法で共有


Microsoft Security DevOps の Azure DevOps 拡張機能の構成

Microsoft Security DevOps は、開発ライフサイクルに静的分析を統合するコマンドライン アプリケーションです。 移植可能な構成を使用して最新の SDL、セキュリティ、コンプライアンス アナライザーをインストール、構成、実行し、環境間で一貫性のある確定的な実行を保証します。

Microsoft Security DevOps では、次のオープンソース ツールを使用します。

名前 Language ライセンス
マルウェア対策 Microsoft Defender for Endpoint からの Windows のマルウェア対策保護。 マルウェアをスキャンし、悪意のあるコンテンツが検出された場合にビルドを中断します。 Windows 最新のエージェントで既定で実行されます。 オープン ソースではない
Bandit Python Apache License 2.0
BinSkim バイナリ ターゲット: Windows、ELF MIT ライセンス
Checkov Terraform、Terraform プラン、CloudFormation、AWS SAM、Kubernetes、Helm chart、Kustomize、Dockerfile、Serverless、Bicep、OpenAPI、ARM Apache License 2.0
ESLint JavaScript MIT ライセンス
IaCFileScanner Terraform、CloudFormation、ARM テンプレート、Bicep 用のテンプレート マッピング ツール オープン ソースではない
Template Analyzer ARM テンプレート、Bicep MIT ライセンス
Terrascan Terraform (HCL2)、Kubernetes (JSON/YAML)、Helm v3、Kustomize、Dockerfiles、CloudFormation Apache License 2.0
Trivy コンテナー イメージ、コードとしてのインフラストラクチャ (IaC) Apache License 2.0

2023 年 9 月 20 日の時点で、Azure DevOps 用 Microsoft Security DevOps (MSDO) 拡張機能内のシークレット スキャン (CredScan) ツールは非推奨になりました。 MSDO シークレットのスキャンは、 Azure DevOps の GitHub Advanced Security に置き換えられます。

[前提条件]

  • 拡張機能をインストールするには、Azure DevOps 組織の Project Collection 管理者特権が必要です。 アクセス権がない場合は、インストール時に Azure DevOps 管理者に要求します。

Microsoft Security DevOps の Azure DevOps 拡張機能の構成

  1. Azure DevOps にサインインします。

  2. ショッピング バッグ>管理拡張機能に移動します。

    拡張機能の管理画面に移動する方法を示すスクリーンショット。

  3. [ 共有] を選択します。

    Microsoft Security DevOps 拡張機能を既にインストールしている場合は、[インストール済み] タブに表示されます。

  4. Microsoft Security DevOps を選択します。

    Microsoft Security DevOps を選択する場所を示すスクリーンショット。

  5. [インストール] を選択します。

  6. ドロップダウン メニューから適切な組織を選択します。

  7. [インストール] を選択します。

  8. [ 組織に進む] を選択します

YAML を使用してパイプラインを構成する

  1. Azure DevOps にサインインします。

  2. プロジェクトを選択します。

  3. パイプライン>新しいパイプラインに移動します。

    DevOps で作成パイプラインを検索する場所を示すスクリーンショット。

  4. [Azure Repos Git] を選択します。

    移動先を示すスクリーンショット。Azure リポジトリ git を選択します。

  5. 関連するリポジトリを選択します。

    リポジトリを選択する場所を示すスクリーンショット。

  6. [スタート パイプライン] を選択します。

    スターター パイプラインを選択する場所を示すスクリーンショット。

  7. 次の YAML をパイプラインに貼り付けます。

    # Starter pipeline
    # Start with a minimal pipeline that you can customize to build and deploy your code.
    # Add steps that build, run tests, deploy, and more:
    # https://aka.ms/yaml
    trigger: none
    pool:
      # ubuntu-latest also supported.
      vmImage: 'windows-latest'
    steps:
    - task: MicrosoftSecurityDevOps@1
      displayName: 'Microsoft Security DevOps'
      # inputs:    
        # config: string. Optional. A file path to an MSDO configuration file ('*.gdnconfig'). Vist the MSDO GitHub wiki linked below for additional configuration instructions
        # policy: 'azuredevops' | 'microsoft' | 'none'. Optional. The name of a well-known Microsoft policy to determine the tools/checks to run. If no configuration file or list of tools is provided, the policy may instruct MSDO which tools to run. Default: azuredevops.
        # categories: string. Optional. A comma-separated list of analyzer categories to run. Values: 'code', 'artifacts', 'IaC', 'containers'. Example: 'IaC, containers'. Defaults to all.
        # languages: string. Optional. A comma-separated list of languages to analyze. Example: 'javascript,typescript'. Defaults to all.
        # tools: string. Optional. A comma-separated list of analyzer tools to run. Values: 'bandit', 'binskim', 'checkov', 'eslint', 'templateanalyzer', 'terrascan', 'trivy'. Example 'templateanalyzer, trivy'
        # break: boolean. Optional. If true, will fail this build step if any high severity level results are found. Default: false.
        # publish: boolean. Optional. If true, will publish the output SARIF results file to the chosen pipeline artifact. Default: true.
        # artifactName: string. Optional. The name of the pipeline artifact to publish the SARIF result file to. Default: CodeAnalysisLogs*.
    

    Defender for Cloud との統合には artifactName 'CodeAnalysisLogs' が必要です。 その他のツール構成オプションと環境変数については、Microsoft Security DevOps Wiki を参照してください。

  8. [保存して実行] を選択して、パイプラインをコミットして実行します。

    SARIF SAST スキャン タブ拡張機能をインストールして、パイプラインの [ スキャン ] タブに SARIF 分析結果を自動的に表示します。

サード パーティのセキュリティ ツールから Defender for Cloud への結果のアップロード

Defender for Cloud では、コードからクラウドへの可視性のために、他のセキュリティ ツールから SARIF の結果を取り込むことができます。 これらの結果をアップロードするには、Azure DevOps リポジトリが Defender for Cloud にオンボードされていることを確認します。 オンボード後、Defender for Cloud は、SARIF 出力の CodeAnalysisLogs 成果物を継続的に監視します。

PublishBuildArtifacts@1 タスクを使用して、SARIF ファイルをCodeAnalysisLogs成果物に発行します。 例えば次が挙げられます。

- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: 'results.sarif'
    ArtifactName: 'CodeAnalysisLogs'

Defender for Cloud では、これらの結果は影響を受けるリポジトリの評価「Azure DevOps リポジトリはコード スキャンの結果を解決する必要があります」のもとに表示されます。