Demo deployment
The demo deployment offers a streamlined experience using a predefined raw
sample dataset. It provides an end-to-end workflow to deploy the
Google Cloud Cortex Framework Dataform pipelines for orchestration and
to initialize the corresponding BigQuery datasets with sample data.
Running uv run cortex-demo creates raw, data foundation, and data products
datasets for each selected source system (sap and sfdc), the
cortex_demo_samples dataset for SAP solution samples when deploying SAP, and
the dataform_assertions dataset during preflight checks (which
Dataform populates with assertion views when pipeline actions
run).
Before you begin
Ensure you have completed the prerequisites outlined on the Prerequisites page, before continuing with the demo deployment.
Get the required Identity and Access Management roles
Obtain the required Identity and Access Management (IAM) permissions to deploy Cortex Framework content within the target Google Cloud project.
Roles for target project
To get the permissions that you need to deploy Cortex Framework, ask your administrator to grant you the following IAM roles on your target project:
- BigQuery Job User (
roles/bigquery.jobUser) - BigQuery Data Editor (
roles/bigquery.dataEditor) - Dataform Admin (
roles/dataform.admin) - Service Usage Consumer (
roles/serviceusage.serviceUsageConsumer)
For more information about granting roles, see Manage access to projects, folders, and organizations.
You might also be able to get the required permissions through custom roles or other predefined roles.
To grant the requested roles to a user, run the following script:
# Grant BigQuery JobUser to the user
gcloud projects add-iam-policy-binding PROJECT_ID --member="user:USER_EMAIL" \
--role="roles/bigquery.jobUser"
# Grant BigQuery DataEditor to the user
gcloud projects add-iam-policy-binding PROJECT_ID --member="user:USER_EMAIL" \
--role="roles/bigquery.dataEditor"
# Grant Dataform Admin to the user
gcloud projects add-iam-policy-binding PROJECT_ID --member="user:USER_EMAIL" \
--role="roles/dataform.admin"
# Grant Service Usage Consumer to the user
gcloud projects add-iam-policy-binding PROJECT_ID --member="user:USER_EMAIL" \
--role="roles/serviceusage.serviceUsageConsumer"
Replace the following:
PROJECT_ID: your target Google Cloud project ID, for example:my-cortex-demo-project.USER_EMAIL: the email address of the deploying user, for example:analyst@example.com.
Optional: Service account IAM roles
The following roles are required only when you pass --create-workflow-configs
(which requires --service-account) to create one release configuration, five
scheduled Dataform workflow configurations (hourly, daily,
weekly, monthly, and yearly in UTC), and an immediate on-demand workflow
run. Providing a service account with --create-workflow-configs simplifies
post-deployment tasks by setting up the scheduling of the data pipelines. You
can also manually trigger any workflow configuration in Dataform on
the Releases & scheduling tab using the three-dot menu.
To get the permissions that you need to deploy the demo of Cortex Framework, ask your administrator to grant you the following IAM roles on your custom Dataform service account:
- Service Account Token Creator (
roles/iam.serviceAccountTokenCreator) - Service Account User (
roles/iam.serviceAccountUser)
For more information about granting roles, see Manage access to projects, folders, and organizations.
You might also be able to get the required permissions through custom roles or other predefined roles.
To create the service account and grant the necessary roles, run the following script:
export PROJECT_ID=PROJECT_ID
export USER_EMAIL=USER_EMAIL
export SERVICE_ACCOUNT_NAME=cortex-dataform
# Create the service account
gcloud iam service-accounts create $SERVICE_ACCOUNT_NAME \
--description="Service account for Cortex Dataform execution" \
--display-name="Cortex Dataform Service Account" \
--project=$PROJECT_ID
# Wait for the service account to propagate (IAM eventual consistency)
sleep 10
# Grant BigQuery DataEditor to the service account
gcloud projects add-iam-policy-binding $PROJECT_ID \
--member="serviceAccount:$SERVICE_ACCOUNT_NAME@$PROJECT_ID.iam.gserviceaccount.com" \
--role="roles/bigquery.dataEditor"
# Grant BigQuery jobUser to the service account
gcloud projects add-iam-policy-binding $PROJECT_ID \
--member="serviceAccount:$SERVICE_ACCOUNT_NAME@$PROJECT_ID.iam.gserviceaccount.com" \
--role="roles/bigquery.jobUser"
# Grant Dataform Editor to the service account
gcloud projects add-iam-policy-binding $PROJECT_ID \
--member="serviceAccount:$SERVICE_ACCOUNT_NAME@$PROJECT_ID.iam.gserviceaccount.com" \
--role="roles/dataform.editor"
# Grant the user Service Account Token Creator and Service Account User roles on the Cortex service account
gcloud iam service-accounts add-iam-policy-binding \
$SERVICE_ACCOUNT_NAME@$PROJECT_ID.iam.gserviceaccount.com \
--member="user:$USER_EMAIL" \
--role="roles/iam.serviceAccountTokenCreator" \
--project=$PROJECT_ID
gcloud iam service-accounts add-iam-policy-binding \
$SERVICE_ACCOUNT_NAME@$PROJECT_ID.iam.gserviceaccount.com \
--member="user:$USER_EMAIL" \
--role="roles/iam.serviceAccountUser" \
--project=$PROJECT_ID
PROJECT_NUMBER=$(gcloud projects describe $PROJECT_ID --format="value(projectNumber)")
# Note: If the following commands fail with a "serviceAccount:service-$PROJECT_NUMBER@..."
# not found error, the default Dataform service agent has not yet been provisioned
# for the project. Run these commands after the initial `uv run cortex-*` invocation.
# Grant the Dataform Service Account the Token Creator role on the Cortex service account
gcloud iam service-accounts add-iam-policy-binding \
$SERVICE_ACCOUNT_NAME@$PROJECT_ID.iam.gserviceaccount.com \
--member="serviceAccount:service-$PROJECT_NUMBER@gcp-sa-dataform.iam.gserviceaccount.com" \
--role="roles/iam.serviceAccountTokenCreator" \
--project=$PROJECT_ID
# Grant the Dataform Service Account the Service Account User role on the Cortex service account
gcloud iam service-accounts add-iam-policy-binding \
$SERVICE_ACCOUNT_NAME@$PROJECT_ID.iam.gserviceaccount.com \
--member="serviceAccount:service-$PROJECT_NUMBER@gcp-sa-dataform.iam.gserviceaccount.com" \
--role="roles/iam.serviceAccountUser" \
--project=$PROJECT_ID
Replace the following:
PROJECT_ID: your target Google Cloud project ID, for example:my-cortex-demo-project.USER_EMAIL: the email address of the deploying user, for example:analyst@example.com.
Deployment
Follow these steps to create a virtual Python environment, synchronize the
dependencies, and trigger the data pipelines. Remember to use
the Cortex Framework uv scripts to build and push your data
assets to your Google Cloud project, transforming your local configurations
into a live, scalable data architecture. For more information, see the
uv installation
in the Prerequisites section.
Execute the demo deployment
Run the following command to trigger the deployment. This process performs the following actions:
- Verify that all prerequisites are complete.
- Load sample data into a BigQuery dataset to serve as the raw layer for demonstration purposes.
- Build Dataform pipelines for processing the sample data through the Cortex Framework data layers.
- Create the Dataform repository and workspace, then sync the compiled artifacts with the repository.
- Optional: When you pass
--create-workflow-configstogether with--service-account, commit and push the workspace, create one release configuration (<repository_name>-release), create five scheduled Dataform workflow configurations (hourly,daily,weekly,monthly, andyearlyin UTC), and trigger an immediate on-demand run.
Running uv run cortex-demo collects anonymous telemetry (see
Telemetry to opt out). Run uv run cortex-demo -h or
see CLI demo deployment for all available
flags.
For demo deployment with default values (which deploys both SAP S/4HANA and
Salesforce sample datasets because --sources defaults to all and
--sap-version defaults to s4), run the following command (pass
--sap-version ecc for SAP ECC):
uv run cortex-demo --project-id=PROJECT_ID
Replace the following:
PROJECT_ID: your target Google Cloud project ID, for example:my-cortex-demo-project.
To deploy only Salesforce demo datasets and data products, pass
--sources sfdc:
uv run cortex-demo --project-id=PROJECT_ID --sources sfdc
Replace the following:
PROJECT_ID: your target Google Cloud project ID, for example:my-cortex-demo-project.
For demo deployment with a service account, five scheduled workflow configurations, and an immediate on-demand run, run the following command:
export PROJECT_ID=PROJECT_ID
export SERVICE_ACCOUNT_NAME=cortex-dataform
uv run cortex-demo --project-id=$PROJECT_ID \
--service-account="$SERVICE_ACCOUNT_NAME@$PROJECT_ID.iam.gserviceaccount.com" \
--create-workflow-configs
Replace the following:
PROJECT_ID: your target Google Cloud project ID, for example:my-cortex-demo-project.
Verification
After deployment completes, verify and run your demo pipelines:
- Open Dataform, select the
cortex-framework-demorepository, and open thedemoworkspace (click Compiled graph to inspect the compiled dependency graph). Execute the Dataform actions using one of the following options:
- Option A — Run manually (default deployment): Inside the
demoworkspace, click Start execution > Execute actions > All actions > Start execution, and monitor progress on the Workflow Execution Logs tab. - Option B — Run using workflow schedules (when deployed with
--create-workflow-configs): An initial run starts automatically during deployment. To trigger another run manually, open Releases & scheduling, click the three-dot menu next to a workflow configuration, select Start now, and monitor progress on the Workflow Execution Logs tab.
- Option A — Run manually (default deployment): Inside the
Navigate to the BigQuery console and click Datasets to view the created datasets and verify their schemas and sample rows. Depending on the
--sourcesflag you selected, the created datasets include:cortex_demo_sap_s4_raw: Sample raw SAP tables (when--sourcesisallorsapwith--sap-version s4).cortex_demo_sap_s4_data_foundation: CDC-processed SAP foundation tables.cortex_demo_sfdc_raw: Sample raw Salesforce SObject tables (when--sourcesisallorsfdc).cortex_demo_sfdc_data_foundation: Conformed Salesforce data foundation tables.cortex_demo_data_product: Deployed SAP and Salesforce data products for consumption.cortex_demo_samples: Sample consumption data products for SAP.dataform_assertions: Compiled Dataform data quality assertion views (uv run cortex-democreates the dataset during deployment preflight, and Dataform populates it with assertion views when pipeline actions run).
Optional: Register demo data products in Knowledge Catalog
After you run your demo Dataform pipeline actions and verify that the
demo data product tables are materialized in BigQuery (in
cortex_demo_data_product, and in cortex_demo_samples when SAP is deployed),
you can register your demo data products in
Knowledge Catalog using
uv run cortex-create-kc-data-products.
Because uv run cortex-demo builds its configuration in memory and doesn't
write a config/config.yaml file, complete the following steps to enable the
Dataplex API, grant the required IAM roles, create a demo
configuration file, and register the demo data products.
Enable the Dataplex API and grant required roles
Enable the Dataplex API (dataplex.googleapis.com) in your target
Google Cloud project:
gcloud services enable dataplex.googleapis.com \
--project=PROJECT_ID
Replace PROJECT_ID with your target Google Cloud
project ID, such as my-cortex-demo-project.
To get the permissions that you need to register and clean up demo data products in Knowledge Catalog, ask your administrator to grant you the following IAM roles on your target project:
- Dataplex Editor (
roles/dataplex.editor) - Dataplex Data Products Editor (
roles/dataplex.dataProductsEditor) - Dataplex Entry and EntryLink Owner (
roles/dataplex.entryOwner) - BigQuery Metadata Viewer (
roles/bigquery.metadataViewer) - BigQuery Data Viewer (
roles/bigquery.dataViewer)
For more information about granting roles, see Manage access to projects, folders, and organizations.
You might also be able to get the required permissions through custom roles or other predefined roles.
Grant these roles to the principal running
uv run cortex-create-kc-data-products:
gcloud projects add-iam-policy-binding PROJECT_ID \
--member="user:USER_EMAIL" \
--role="roles/dataplex.editor"
gcloud projects add-iam-policy-binding PROJECT_ID \
--member="user:USER_EMAIL" \
--role="roles/dataplex.dataProductsEditor"
gcloud projects add-iam-policy-binding PROJECT_ID \
--member="user:USER_EMAIL" \
--role="roles/dataplex.entryOwner"
gcloud projects add-iam-policy-binding PROJECT_ID \
--member="user:USER_EMAIL" \
--role="roles/bigquery.metadataViewer"
gcloud projects add-iam-policy-binding PROJECT_ID \
--member="user:USER_EMAIL" \
--role="roles/bigquery.dataViewer"
Replace the following:
PROJECT_ID: Your Google Cloud project ID where you register demo Knowledge Catalog data products (or where your demo datasets are hosted), such asmy-cortex-demo-project.USER_EMAIL: The email address of the principal runninguv run cortex-create-kc-data-products, such asdana@example.com.
Create a demo configuration file
Create a demo configuration file (config/config-demo.yaml) from the
config/config.yaml.example template so uv run cortex-create-kc-data-products
can discover your demo datasets without overwriting an existing
config/config.yaml file. Update the project ID attributes,
BigQuery dataset IDs, and Dataform repository and
workspace settings in config/config-demo.yaml to match the default parameters
of uv run cortex-demo.
Expand the following section for step-by-step instructions to copy the template and edit each required section:
Create and update the
config/config-demo.yaml file for default demo parameters
Follow these steps from the root directory of your cloned
Cortex Framework repository to create
config/config-demo.yaml and align it with the default parameters
used by uv run cortex-demo (--sources all,
--sap-version s4, --bigquery-location US,
--dataform-region us-central1,
--repository-name cortex-framework-demo, and
--workspace-name demo).
-
Copy the example configuration template to a dedicated demo file:
cp config/config.yaml.example config/config-demo.yaml
-
Open
config/config-demo.yamland update all active project ID attributes to your target Google Cloud project ID (PROJECT_ID, matching the--project-idflag):buildEnvironment.buildProjectId: replaceYOUR_BUILD_PROJECT_IDwithPROJECT_ID.data.datasets[].projectId: replaceYOUR_SOURCE_PROJECT_ID(onsap_rawandsfdc_raw) andYOUR_TARGET_PROJECT_ID(onsap_foundation,sfdc_foundation,product_target,samples_target, andcortex_v6_compatibility_target) withPROJECT_ID.deployment.targets[].targetSettings.repositoryProjectId: replaceYOUR_REPO_PROJECT_IDwithPROJECT_ID.
Leave the placeholder project IDs under the disabled
data.modules.catalogsentries (enabled: false) unchanged unless you enable those external catalogs.buildEnvironment: buildProjectId: PROJECT_ID
Replace
PROJECT_IDwith your target Google Cloud project ID, such asmy-cortex-demo-project. -
Under
data.datasets, update thedatasetIdvalues from the template defaults to match the defaultuv run cortex-demodatasets:sap_raw: changecortex_sap_rawtocortex_demo_sap_s4_raw(default--source-sap-raw-dataset-id).sap_foundation: changecortex7_sap_data_foundationtocortex_demo_sap_s4_data_foundation(default--target-sap-foundation-dataset-id).sfdc_raw: changecortex_sfdc_rawtocortex_demo_sfdc_raw(default--source-sfdc-raw-dataset-id).sfdc_foundation: changecortex7_sfdc_data_foundationtocortex_demo_sfdc_data_foundation(default--target-sfdc-foundation-dataset-id).product_target: changecortex7_data_productstocortex_demo_data_product(default--target-dp-dataset-id; note singularproduct).samples_target: changecortex7_samplestocortex_demo_samples(default--target-samples-dataset-id).
Keep the
cortex_v6_compatibility_targetentry indata.datasetsso configuration validation succeeds for the disabled compatibility modules (allcortex_v6_compatibilityentries remainenabled: falseandsyncToKc: false):datasets: - id: sap_raw projectId: PROJECT_ID datasetId: cortex_demo_sap_s4_raw - id: sap_foundation projectId: PROJECT_ID datasetId: cortex_demo_sap_s4_data_foundation - id: sfdc_raw projectId: PROJECT_ID datasetId: cortex_demo_sfdc_raw - id: sfdc_foundation projectId: PROJECT_ID datasetId: cortex_demo_sfdc_data_foundation - id: product_target projectId: PROJECT_ID datasetId: cortex_demo_data_product - id: samples_target projectId: PROJECT_ID datasetId: cortex_demo_samples - id: cortex_v6_compatibility_target projectId: PROJECT_ID datasetId: cortex_v6_compatibility
-
Under
deployment.targets, update the Dataform target settings to match the defaultuv run cortex-demoparameters:repositoryProjectId: replaceYOUR_REPO_PROJECT_IDwithPROJECT_ID.repositoryRegion: keepus-central1(default--dataform-region), or update it to match a custom region.repositoryName: changecortex-repositorytocortex-framework-demo(default--repository-name).workspaceName: changedevtodemo(default--workspace-name).
deployment: targets: - type: dataform enabled: true targetSettings: repositoryProjectId: PROJECT_ID repositoryRegion: us-central1 repositoryName: cortex-framework-demo workspaceName: demo
If you passed
--service-accounttouv run cortex-demo, uncommentserviceAccountundertargetSettingsand set it to your service account email address. -
Optional: Adjust
config/config-demo.yamlif you want to register the SAP solution samples or if you overrode defaultuv run cortex-demoflags:- Include SAP solution samples.
uv run cortex-demodeployssap_sales_performanceandsap_supplier_spend_analysisintocortex_demo_sampleswhen SAP is included, whileconfig/config.yaml.exampleleaves both set toenabled: false. Setenabled: trueon both entries underdata.modules.productsto register them. - Match a custom
--bigquery-location. Updatedata.bigQueryLocationto match the location you passed touv run cortex-demo(defaultUS). - Match a custom
--sourcesvalue. If you deployed with--sources sfdc, setenabled: false(orsyncToKc: false) on the SAP entries underdata.modules.productsso empty data products aren't registered. If you deployed with--sources sap, disable or setsyncToKc: falseon the Salesforce entries. - Match
--sap-version ecc. Updatesap_rawandsap_foundationtocortex_demo_sap_ecc_rawandcortex_demo_sap_ecc_data_foundation, and setmoduleSettings.sapVersion: ecconerp. Enablesap_general_ledger_itemsandsap_inventory_and_special_stocks, disablesap_universal_journal, and switch the version-specificdependencyBindingsonsap_accounts_receivable_insightsandsap_financial_statementsas shown in the inline comments inconfig/config.yaml.example. - Match custom Dataform flags. If you
overrode
--dataform-region,--repository-name, or--workspace-name, updaterepositoryRegion,repositoryName, andworkspaceNameunderdeployment.targetsto match.
- Include SAP solution samples.
Register and verify demo data products
Synchronize your materialized demo data products with Knowledge Catalog:
uv run cortex-create-kc-data-products \ --config config/config-demo.yaml \ --owner-email OWNER_EMAILReplace
OWNER_EMAILwith the email address assigned as the data product owner in Knowledge Catalog, such asdana@example.com.To register all demo data products in a separate governance project instead of the project hosting your demo BigQuery datasets, add
--kc-project-id KC_PROJECT_ID, whereKC_PROJECT_IDis the governance project ID.In the Google Cloud console, go to the Knowledge Catalog Data products page:
On the Google Cloud console toolbar, click the resource selector, and then select your target project.
Click a registered demo data product to inspect its business description, governance labels (including
cortex_framework_created: "true"), and linked BigQuery tables fromcortex_demo_data_product(andcortex_demo_samplesif enabled).
For more information about governance labels, reconciliation behavior, and
production automation, see
Knowledge Catalog integration
and the
uv run cortex-create-kc-data-products CLI reference.
Cleanup demo deployment resources
After a successful demo deployment, you can remove the used Google Cloud
resources to avoid ongoing charges. The following script deletes the created
BigQuery datasets, the Dataform workspace, any workflow
and release configurations, and the Dataform repository. If found, the
script also prompts you to optionally delete the cortex-dataform service
account. If you also registered demo data products in
Knowledge Catalog, remove them by following
Optional: Clean up Knowledge Catalog demo data
products.
Expand the following section to view the demo deployment cleanup script:
Demo deployment cleanup script
Before running the script, replace PROJECT_ID with
your target Google Cloud project ID, such as
my-cortex-demo-project. Also update any variable at the top of
the script whose default you overrode with uv run cortex-demo
flags (such as --sap-version, --dataform-region,
dataset IDs, --repository-name, --workspace-name, or
--service-account):
#!/bin/bash # Define variables using names from uv-run-cortex-demo.md PROJECT_ID="PROJECT_ID" SAP_VERSION="s4" DATAFORM_REGION="us-central1" SOURCE_SAP_RAW_DATASET_ID="cortex_demo_sap_s4_raw" TARGET_SAP_FOUNDATION_DATASET_ID="cortex_demo_sap_s4_data_foundation" if [[ "$SAP_VERSION" == "ecc" ]]; then SOURCE_SAP_RAW_DATASET_ID="cortex_demo_sap_ecc_raw" TARGET_SAP_FOUNDATION_DATASET_ID="cortex_demo_sap_ecc_data_foundation" fi SOURCE_SFDC_RAW_DATASET_ID="cortex_demo_sfdc_raw" TARGET_SFDC_FOUNDATION_DATASET_ID="cortex_demo_sfdc_data_foundation" TARGET_DP_DATASET_ID="cortex_demo_data_product" TARGET_SAMPLES_DATASET_ID="cortex_demo_samples" ASSERTIONS_DATASET_ID="dataform_assertions" REPOSITORY_NAME="cortex-framework-demo" WORKSPACE_NAME="demo" SERVICE_ACCOUNT_NAME="cortex-dataform" # Color codes for formatting status output GREEN='\033[0;32m' YELLOW='\033[0;33m' RED='\033[0;31m' NC='\033[0m' # No Color # Helper function to delete a resource and report status delete_resource() { local label=$1 local url=$2 local resource_type=$3 echo -n "${label}... " local temp_file=$(mktemp) local code=$(curl -s -o "${temp_file}" -w "%{http_code}" -X DELETE \ -H "Authorization: Bearer ${ACCESS_TOKEN}" \ "${url}") if [ "$code" -eq 200 ] || [ "$code" -eq 204 ]; then echo -e "${GREEN}ok${NC}" elif [ "$code" -eq 404 ]; then echo -e "${YELLOW}skipped, ${resource_type} not found${NC}" else echo -e "${RED}failed (HTTP ${code})${NC}" if [ -s "${temp_file}" ]; then echo " Error details:" sed 's/^/ /' "${temp_file}" fi fi rm -f "${temp_file}" } echo "Deleting BigQuery datasets..." for DATASET_ID in "${SOURCE_SAP_RAW_DATASET_ID}" \ "${TARGET_SAP_FOUNDATION_DATASET_ID}" \ "${SOURCE_SFDC_RAW_DATASET_ID}" \ "${TARGET_SFDC_FOUNDATION_DATASET_ID}" \ "${TARGET_DP_DATASET_ID}" \ "${TARGET_SAMPLES_DATASET_ID}" \ "${ASSERTIONS_DATASET_ID}"; do echo "deleting ${PROJECT_ID}:${DATASET_ID}" bq rm -r -f "${PROJECT_ID}:${DATASET_ID}" done ACCESS_TOKEN=$(gcloud auth print-access-token) delete_resource "Deleting Dataform workspace ${WORKSPACE_NAME}" \ "https://dataform.googleapis.com/v1beta1/projects/${PROJECT_ID}/locations/${DATAFORM_REGION}/repositories/${REPOSITORY_NAME}/workspaces/${WORKSPACE_NAME}" \ "workspace" echo "Deleting Dataform workflow configurations..." WORKFLOW_CONFIGS_JSON=$(curl -s -H "Authorization: Bearer ${ACCESS_TOKEN}" \ "https://dataform.googleapis.com/v1beta1/projects/${PROJECT_ID}/locations/${DATAFORM_REGION}/repositories/${REPOSITORY_NAME}/workflowConfigs") WORKFLOW_CONFIGS=$(echo "${WORKFLOW_CONFIGS_JSON}" | grep '"name":' | sed -E 's/.*"name": "([^"]+)".*/\1/') if [ -z "${WORKFLOW_CONFIGS}" ]; then echo -e " No workflow configurations found. ${YELLOW}skipped${NC}" else for config in ${WORKFLOW_CONFIGS}; do delete_resource " Deleting workflow config: ${config##*/}" \ "https://dataform.googleapis.com/v1beta1/${config}" \ "workflow config" done fi echo "Deleting Dataform release configurations..." RELEASE_CONFIGS_JSON=$(curl -s -H "Authorization: Bearer ${ACCESS_TOKEN}" \ "https://dataform.googleapis.com/v1beta1/projects/${PROJECT_ID}/locations/${DATAFORM_REGION}/repositories/${REPOSITORY_NAME}/releaseConfigs") RELEASE_CONFIGS=$(echo "${RELEASE_CONFIGS_JSON}" | grep '"name":' | sed -E 's/.*"name": "([^"]+)".*/\1/') if [ -z "${RELEASE_CONFIGS}" ]; then echo -e " No release configurations found. ${YELLOW}skipped${NC}" else for config in ${RELEASE_CONFIGS}; do delete_resource " Deleting release config: ${config##*/}" \ "https://dataform.googleapis.com/v1beta1/${config}" \ "release config" done fi delete_resource "Deleting Dataform repository ${REPOSITORY_NAME}" \ "https://dataform.googleapis.com/v1beta1/projects/${PROJECT_ID}/locations/${DATAFORM_REGION}/repositories/${REPOSITORY_NAME}?force=true" \ "repository" if gcloud iam service-accounts describe "${SERVICE_ACCOUNT_NAME}@${PROJECT_ID}.iam.gserviceaccount.com" --project="${PROJECT_ID}" >/dev/null 2>&1; then read -p "Do you want to delete the service account ${SERVICE_ACCOUNT_NAME}? (y/N): " -r if [[ "$REPLY" =~ ^[Yy]$ ]]; then echo -n "Deleting service account ${SERVICE_ACCOUNT_NAME}... " ERROR_MSG=$(gcloud iam service-accounts delete "${SERVICE_ACCOUNT_NAME}@${PROJECT_ID}.iam.gserviceaccount.com" --project="${PROJECT_ID}" --quiet 2>&1) EXIT_CODE=$? if [ ${EXIT_CODE} -eq 0 ]; then echo -e "${GREEN}ok${NC}" else echo -e "${RED}failed${NC}" echo " Error details:" echo "${ERROR_MSG}" | sed 's/^/ /' fi else echo -e "Deleting service account ${SERVICE_ACCOUNT_NAME}... ${YELLOW}skipped (user cancelled)${NC}" fi else echo -e "Deleting service account ${SERVICE_ACCOUNT_NAME}... ${YELLOW}skipped, service account not found${NC}" fi echo "Cortex Framework demo deployment cleanup complete."
Optional: Clean up Knowledge Catalog demo data products
If you registered demo data products in
Knowledge Catalog, run the following standalone script
to delete all Cortex Framework-managed data products and their
linked data assets. The script filters for data products carrying the
cortex_framework_created: "true" (or legacy
cortex-framework-created: "true") ownership label so customer-managed catalog
entries aren't modified, and prompts for confirmation before deleting any
resources.
Run this script with a principal that has the
Knowledge Catalog roles granted in
Enable the Dataplex API and grant required roles,
including roles/dataplex.dataProductsEditor. You can run this script before
or after deleting your demo BigQuery datasets.
Expand the following section to view the standalone Knowledge Catalog cleanup script:
Knowledge Catalog demo data products cleanup script
Run the following cleanup script after adjusting its configuration values:
#!/bin/bash PROJECT_ID="PROJECT_ID" BIGQUERY_LOCATION="US" # Knowledge Catalog locations are lowercased (for example, "US" becomes "us"). KC_LOCATION=$(echo "${BIGQUERY_LOCATION}" | tr '[:upper:]' '[:lower:]') # Color codes for formatting status output GREEN='\033[0;32m' YELLOW='\033[0;33m' RED='\033[0;31m' NC='\033[0m' # No Color KC_ERR_FILE=$(mktemp) trap 'rm -f "${KC_ERR_FILE}"' EXIT KC_DATA_PRODUCTS=$(gcloud dataplex data-products list \ --project="${PROJECT_ID}" \ --location="${KC_LOCATION}" \ --filter='labels.cortex_framework_created="true" OR labels.cortex-framework-created="true"' \ --format="value(name)" \ --quiet 2>"${KC_ERR_FILE}") KC_LIST_EXIT_CODE=$? if [ ${KC_LIST_EXIT_CODE} -ne 0 ]; then if grep -qE "SERVICE_DISABLED|API \[dataplex\.googleapis\.com\] not enabled|has not been used in project" "${KC_ERR_FILE}"; then echo -e "Deleting Knowledge Catalog data products... ${YELLOW}skipped, Dataplex API not enabled${NC}" else echo -e "Deleting Knowledge Catalog data products... ${RED}failed to list data products${NC}" if [ -s "${KC_ERR_FILE}" ]; then echo " Error details:" sed 's/^/ /' "${KC_ERR_FILE}" fi exit 1 fi elif [ -z "${KC_DATA_PRODUCTS}" ]; then echo -e "Deleting Knowledge Catalog data products... ${YELLOW}skipped, no Cortex Framework data products found${NC}" else echo "Found Cortex Framework Knowledge Catalog data products in ${PROJECT_ID} (${KC_LOCATION}):" while IFS= read -r DP_NAME; do [ -n "${DP_NAME}" ] && echo " - ${DP_NAME##*/}" done <<< "${KC_DATA_PRODUCTS}" read -p "Do you want to delete these Knowledge Catalog data products and their linked assets? (y/N): " -r if [[ "$REPLY" =~ ^[Yy]$ ]]; then while IFS= read -r DP_NAME; do [ -z "${DP_NAME}" ] && continue DP_ID="${DP_NAME##*/}" # Remove linked data assets before deleting the data product ASSET_LIST_ERR=$(mktemp) DATA_ASSETS=$(gcloud dataplex data-products data-assets list \ --data-product="${DP_ID}" \ --project="${PROJECT_ID}" \ --location="${KC_LOCATION}" \ --format="value(name)" \ --quiet </dev/null 2>"${ASSET_LIST_ERR}") ASSET_LIST_EXIT=$? if [ ${ASSET_LIST_EXIT} -ne 0 ]; then echo -e "Listing data assets for ${DP_ID}... ${RED}failed${NC}" if [ -s "${ASSET_LIST_ERR}" ]; then echo " Error details:" sed 's/^/ /' "${ASSET_LIST_ERR}" fi rm -f "${ASSET_LIST_ERR}" continue fi rm -f "${ASSET_LIST_ERR}" ASSET_DELETE_FAILED=0 if [ -n "${DATA_ASSETS}" ]; then while IFS= read -r ASSET_NAME; do [ -z "${ASSET_NAME}" ] && continue ASSET_ID="${ASSET_NAME##*/}" echo -n " Deleting data asset ${ASSET_ID} from ${DP_ID}... " ERROR_MSG=$(gcloud dataplex data-products data-assets delete "${ASSET_ID}" \ --data-product="${DP_ID}" \ --project="${PROJECT_ID}" \ --location="${KC_LOCATION}" \ --quiet </dev/null 2>&1) if [ $? -eq 0 ]; then echo -e "${GREEN}ok${NC}" else ASSET_DELETE_FAILED=1 echo -e "${RED}failed${NC}" echo " Error details:" echo "${ERROR_MSG}" | sed 's/^/ /' fi done <<< "${DATA_ASSETS}" fi if [ ${ASSET_DELETE_FAILED} -ne 0 ]; then echo -e "Deleting Knowledge Catalog data product ${DP_ID}... ${YELLOW}skipped, failed to remove all linked assets${NC}" continue fi echo -n "Deleting Knowledge Catalog data product ${DP_ID}... " ERROR_MSG=$(gcloud dataplex data-products delete "${DP_ID}" \ --project="${PROJECT_ID}" \ --location="${KC_LOCATION}" \ --quiet </dev/null 2>&1) if [ $? -eq 0 ]; then echo -e "${GREEN}ok${NC}" else echo -e "${RED}failed${NC}" echo " Error details:" echo "${ERROR_MSG}" | sed 's/^/ /' fi done <<< "${KC_DATA_PRODUCTS}" else echo -e "Deleting Knowledge Catalog data products... ${YELLOW}skipped (user cancelled)${NC}" fi fi echo "Cortex Framework Knowledge Catalog demo cleanup complete."
Replace the following:
PROJECT_ID: The Google Cloud project ID where your demo Knowledge Catalog data products are registered (your demo project ID, or your governance project ID if you passed--kc-project-id), such asmy-cortex-demo-project.
If you used a non-default location in config/config-demo.yaml,
also update BIGQUERY_LOCATION at the top of the script.
If you created config/config-demo.yaml for demo registration, you can also
remove that local configuration file by running
rm -f config/config-demo.yaml.
Next steps
- Follow the Production deployment to learn how to deploy Cortex Framework in production environments.
- Read about Source system integration to learn how to connect your production systems.