CLI Cortex Framework apply security
uv run cortex-apply-security validates required target BigQuery and
Data Catalog APIs and policy tags, patches column-level policyTags
onto materialized BigQuery table schemas, and drops stale or
disabled row access policies managed by Google Cloud Cortex Framework after
Dataform workflow runs. The command works the same way for both
type: dataform and type: git deployment workflows.
Synopsis
uv run cortex-apply-security [-h] \
[-c CONFIG_PATH | --config CONFIG_PATH] \
[--enable-apis] [--disable-telemetry] \
[--dry-run]
Replace the following:
CONFIG_PATH: path to your globalconfig.yamlfile, for example:config/config.yaml.
Pre-flight and reconciliation behavior
When you run uv run cortex-apply-security, the tool performs the following
steps for both type: dataform and type: git deployment targets:
- Loads and resolves
config.yaml. If thedata.securityblock is omitted entirely, the tool logs an informational message and exits with status0without modifying BigQuery, leaving any previously applied columnpolicyTagsand row access policies (includingcortex_pipeline_sa_bypass) attached. To tear down security workspace-wide, keepdata.securitywithenabled: falseuntil reconciliation completes. - Validates
bigquery.googleapis.comon foundation and data product target dataset projects (including whendata.security.enabledisfalse), while skippingdataform.googleapis.comand external BigLake Delta Sharing catalog project APIs (bigqueryreservation.googleapis.com,cloudresourcemanager.googleapis.com, and catalogbigquery.googleapis.com). Whendata.security.enabledistrueand column policy tags are configured, the tool also validatesdatacatalog.googleapis.comon policy tag taxonomy projects and column-level security target projects, and verifies that every referenced policy tag exists, matchesdata.bigQueryLocation, and belongs to a taxonomy with Enforce access control (FINE_GRAINED_ACCESS_CONTROL) enabled. - Reconciles
TableFieldSchema.policyTags(tables.patch) and stale or disabled Cortex Framework row access policies (rowAccessPolicies.list) across enabled materialized foundation and data product tables. Whendata.security.enabledisfalse, reconciliation clears Cortex Framework-managed columnpolicyTagsand drops Cortex Framework-managed row access policies. If governed tables haven't been materialized by Dataform yet, the tool reconciles existing tables and logs a warning listing the unmaterialized tables.
Global flags
The following table describes all flags supported by
uv run cortex-apply-security:
| Flag | Description | Default |
|---|---|---|
-h, --help |
Show the command help message and exit. | None |
-c, --config CONFIG_PATH |
Path to the global config.yaml configuration file. |
config/config.yaml |
--enable-apis |
Enable missing required Google Cloud APIs (bigquery.googleapis.com and datacatalog.googleapis.com) automatically without interactive prompts. Can't be combined with --dry-run. |
false |
--dry-run |
Run read-only pre-flight checks and log planned BigQuery column policy tag updates and row access policy drops ([DRY-RUN]) without modifying Google Cloud resources. Can't be combined with --enable-apis. |
false |
--disable-telemetry |
Disable telemetry event logging and suppress the startup telemetry consent notice during execution (cortex-apply-security runs don't send telemetry requests). For details, see Cortex Framework telemetry. |
false |
Examples
Preview planned column policy tag and row access policy changes without modifying BigQuery:
export CORTEX_CONFIG_FILE=config/config.yaml
uv run cortex-apply-security --config $CORTEX_CONFIG_FILE --dry-run
Apply column policy tags and clean up stale row access policies after a Dataform workflow run completes:
export CORTEX_CONFIG_FILE=config/config.yaml
uv run cortex-apply-security --config $CORTEX_CONFIG_FILE
What's next
- Configure declarative 3-tier security rules and dynamic data masking in Row- and column-level security.
- Complete your workflow execution and verification steps in Post-deployment steps.
- Deploy compiled artifacts with
uv run cortex-deploy.