|
| 1 | +--- |
| 2 | +title: Enable/Disable Trivy Vulnerability Scanning in Azure Operator Nexus |
| 3 | +description: Get instructions on enabling/disabling the Trivy Vulnerability Scanning setting. |
| 4 | +ms.service: azure-operator-nexus |
| 5 | +ms.custom: template-how-to, devx-track-azurecli |
| 6 | +ms.topic: how-to |
| 7 | +ms.date: 11/14/2024 |
| 8 | +author: sangeetgupta |
| 9 | +ms.author: sangeetgupta |
| 10 | +--- |
| 11 | + |
| 12 | +# Enable/Disable Trivy Vulnerability Scanning in Azure Operator Nexus Cluster |
| 13 | + |
| 14 | +This guide provides you with instructions on how to enable or disable Trivy Vulnerability Scanning in an Azure Operator Nexus cluster. |
| 15 | + |
| 16 | +## Before you begin |
| 17 | + |
| 18 | +- Install the latest version of the [appropriate CLI extensions](./howto-install-cli-extensions.md). |
| 19 | + |
| 20 | +## Setting variables |
| 21 | + |
| 22 | +To help with configuring Trivy Vulnerability Scanning, define these environment variables used by the various commands throughout this guide. |
| 23 | + |
| 24 | +> [!NOTE] |
| 25 | +> These environment variable values do not reflect a real deployment and users MUST change them to match their environments. |
| 26 | +
|
| 27 | +```bash |
| 28 | +# SUBSCRIPTION_ID: Subscription of your cluster |
| 29 | +export SUBSCRIPTION_ID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" |
| 30 | +# RESOURCE_GROUP: Resource group of your cluster |
| 31 | +export RESOURCE_GROUP="contoso-cluster-rg" |
| 32 | +# MANAGED_RESOURCE_GROUP: Managed resource group managed by your cluster |
| 33 | +export MANAGED_RESOURCE_GROUP="contoso-cluster-managed-rg" |
| 34 | +# CLUSTER_NAME: Name of your cluster |
| 35 | +export CLUSTER_NAME="contoso-cluster" |
| 36 | +``` |
| 37 | + |
| 38 | +## Defaults for Trivy Vulnerability Scanning |
| 39 | +The Trivy Vulnerability Scanning is `Enabled` by default. |
| 40 | + |
| 41 | +## Configuring Trivy Vulnerability Scanning |
| 42 | +The `az networkcloud cluster update` command allows you to update of the settings of Trivy Vulnerability Scanning by using the argument `--vulnerability-scanning-settings container-scan="<setting>"`. |
| 43 | + |
| 44 | +The following command configures the `setting` for your Cluster. |
| 45 | + |
| 46 | +```bash |
| 47 | +az networkcloud cluster update \ |
| 48 | +--subscription ${SUBSCRIPTION_ID} \ |
| 49 | +--resource-group ${RESOURCE_GROUP} \ |
| 50 | +--cluster-name ${CLUSTER_NAME} \ |
| 51 | +--vulnerability-scanning-settings container-scan="<setting>" |
| 52 | +``` |
| 53 | + |
| 54 | +Allowed values for `<setting>`: `Disabled`, `Enabled`. |
| 55 | +- `Disabled`: Trivy Vulnerability Scanning is turned off on the Cluster and no scans are performed. |
| 56 | +- `Enabled`: Trivy Vulnerability Scanning is enabled on the Cluster and scans are performed. |
| 57 | + |
| 58 | +You can confirm that setting was updated by inspecting the output for the following JSON snippet from the Cluster resource view: |
| 59 | + |
| 60 | +```json |
| 61 | + "vulnerabilityScanningSettings": { |
| 62 | + "containerScan": "<setting>" |
| 63 | + } |
| 64 | +``` |
0 commit comments