A company uses Azure DevOps and requires that all pipeline runs are audited and that sensitive information (e.g., passwords, keys) is never exposed in logs. Which TWO actions should you take? (Choose TWO.)
Trap 1: In tasks that run scripts, set the 'Logging command' option to…
The 'Logging command' option 'ignore' tells the agent to disregard special logging commands like ##vso[task.setvariable] in script output, but it has no effect on normal stdout/stderr streams. A script that executes 'echo $password' will still print the secret to the pipeline log regardless of this setting. To prevent output leakage, you must use secret variables (which are masked by the agent) or explicitly redact the value in the script. This option is about command processing, not about log suppression.
Trap 2: Store all sensitive information in a variable group and reference…
Variable groups let you group variables for reuse across pipelines, and you can mark individual variables as secret during creation. However, simply storing sensitive information in a variable group without also toggling the secret flag leaves those values as plaintext, which Azure DevOps will display in the logs when referenced. Even if you do mark them as secret, the group itself does not guarantee masking; the 'Log secret values' checkbox and the variable's secret type determine output redaction. The real requirement is marking values as secret, not just storing them in a group.
Trap 3: Configure the service connection to use 'Read-only' scope.
A service connection with Read-only scope restricts the permissions of the connected resource (e.g., Azure Service Management API) to read-only operations, preventing unintended modifications. However, this authorization control does not affect the pipeline's log output; if a task prints the service connection's client secret or token, it will appear in plaintext. Read-only scope addresses what actions the connection can perform, not what information appears in logs, so it is not a solution for protecting sensitive data in logs.
- A
In tasks that run scripts, set the 'Logging command' option to 'ignore' to prevent script output from being captured in the log.
Why wrong: The 'Logging command' option 'ignore' tells the agent to disregard special logging commands like ##vso[task.setvariable] in script output, but it has no effect on normal stdout/stderr streams. A script that executes 'echo $password' will still print the secret to the pipeline log regardless of this setting. To prevent output leakage, you must use secret variables (which are masked by the agent) or explicitly redact the value in the script. This option is about command processing, not about log suppression.
- B
Store all sensitive information in a variable group and reference it in the pipeline.
Why wrong: Variable groups let you group variables for reuse across pipelines, and you can mark individual variables as secret during creation. However, simply storing sensitive information in a variable group without also toggling the secret flag leaves those values as plaintext, which Azure DevOps will display in the logs when referenced. Even if you do mark them as secret, the group itself does not guarantee masking; the 'Log secret values' checkbox and the variable's secret type determine output redaction. The real requirement is marking values as secret, not just storing them in a group.
- C
Configure the service connection to use 'Read-only' scope.
Why wrong: A service connection with Read-only scope restricts the permissions of the connected resource (e.g., Azure Service Management API) to read-only operations, preventing unintended modifications. However, this authorization control does not affect the pipeline's log output; if a task prints the service connection's client secret or token, it will appear in plaintext. Read-only scope addresses what actions the connection can perform, not what information appears in logs, so it is not a solution for protecting sensitive data in logs.
- D
Use secret pipeline variables and ensure the 'Log secret values in the pipeline' checkbox is unchecked.
Secret pipeline variables are encrypted at rest and injected into the agent runtime as environment variables. With the 'Log secret values in the pipeline' checkbox unchecked, the agent's log filter masks the variable's value in all stdout, stderr, and task output, even if a script echoes it. This is the built-in, supported mechanism for protecting credentials because it combines access-controlled storage with output redaction. Always ensure the variable is marked secret; non-secret variables are not masked.
- E
Enable Azure DevOps audit logging and send logs to a security information and event management (SIEM) system.
Azure DevOps audit logging records a feed of events including pipeline changes, variable group access, and service connection use. By streaming these logs to a SIEM via Azure Monitor or Event Hubs, security teams can set up correlation rules and alerts for suspicious activity, such as a secret being added to a log or a pipeline running with unintended access. This does not prevent leakage but provides detection and forensic evidence for incidents, which is essential for incident response and compliance. It complements secret masking rather than replacing it.