Prepare and test your skills
Prepare and test your skills
Free sample question, answered and explained below. The Professional Cloud Security Engineer practice bank has 1,343 more like it. Try 10 free: instant score, no account.
A security engineer is tasked with evaluating the operational impact of a new constraint for the gcp.restrictServiceUsage organization policy across an enterprise resource hierarchy. The organization already has an active live policy configured on the organization node that restricts certain API services.
The engineer needs to configure the new constraint rules in dry-run mode to generate violation logs in Cloud Audit Logs without disrupting developer operations or modifying the existing live enforcement rules.
Which procedure should the security engineer follow using the Google Cloud CLI?
dryRunSpec field, and execute gcloud org-policies set-policy POLICY_PATH --update-mask=dryRunSpec.The Organization Policy Service supports testing policies prior to live enforcement using the dry-run mode specification (dryRunSpec). A policy defined under dryRunSpec evaluates incoming resource requests against configured list or boolean rules without rejecting non-compliant API calls. When a non-compliant action occurs, an organization policy audit log is emitted to Cloud Logging showing the potential violation. Setting the --update-mask=dryRunSpec flag ensures that only the dry-run configuration is updated on the target resource, preserving the active spec configuration.
dryRunSpec ensures that API calls violating the new service restrictions are permitted rather than blocked.dryRunSpec are captured directly in audit logs, allowing administrators to quantify impact.--update-mask=dryRunSpec instructs gcloud to update exclusively the dry-run specification without overwriting, modifying, or clearing the currently enforced live rules in the spec field.spec rules.spec (enforced live) and dryRunSpec (simulated) to coexist on the same resource.dryRunSpec rules unless explicitly overridden.This approach leverages the native Organization Policy Service v2 architecture. Alternative methods that place test rules in the live spec field risk service outages or disable enforcement entirely.
spec field with enforce: false and action: audit, and execute gcloud org-policies set-policy POLICY_PATH --update-mask=spec.This option attempts to configure auditing by modifying the live spec block directly and introducing non-existent schema properties like action: audit.
action: audit property within the spec field. Organization policy rules define values (for list constraints) or enforce (for boolean constraints), not auditing actions.--update-mask=spec with enforce: false modifies or disables the active live enforcement rules currently protecting the environment instead of maintaining them untouched.enforce: false simply disables constraint enforcement, which ceases violation checking rather than generating comparative audit logs for prospective rules.gcloud org-policies set-policy command fails validation if unsupported fields like action are supplied in the YAML manifest.spec field directly removes active guardrails.The goal was to completely disable the live organization policy across the resource hierarchy using the legacy boolean enforcement toggle.
spec field with a CEL condition condition.auditMode(), and execute gcloud org-policies apply POLICY_PATH --audit-only.This option attempts to use a hypothetical Common Expression Language (CEL) condition macro (condition.auditMode()) and a non-existent gcloud sub-command (org-policies apply) to trigger audit-only behavior.
gcloud org-policies set-policy, not gcloud org-policies apply.resource.matchTag()), there is no built-in condition.auditMode() CEL function that converts live constraints into simulation rules.spec without defining a separate dryRunSpec applies the condition directly to live evaluations, which may inadvertently permit or block production operations.--audit-only flag is not supported by the gcloud org-policies command group.The scenario required applying conditional live enforcement based on resource tags using resource.matchTag('TAG_KEY', 'TAG_VALUE').
policyControllerSpec with enforcementAction: dryrun, and execute gcloud org-policies set-policy POLICY_PATH --dry-run.This option conflates GKE Policy Controller (a Kubernetes admission controller based on Gatekeeper/OPA) with the native Google Cloud Organization Policy Service.
policyControllerSpec and enforcementAction: dryrun are constructs used in Policy Controller constraint templates for Kubernetes clusters, not resource hierarchy Organization Policies.gcloud org-policies set-policy command does not accept a --dry-run flag to establish dry-run mode; instead, dry-run policies are declared via the dryRunSpec YAML attribute and applied using the --update-mask flag.policyControllerSpec.The task was deploying a Kubernetes-native compliance constraint bundle (such as CIS GKE Benchmark or NIST SP 800-190) onto an Anthos/GKE cluster using kpt or kubectl.
Answer them yourself and get your score the moment you finish. No account needed.
Full access includes
Keep the momentum going with these hand-picked practice scenarios
Last updated Validated