What you will be able to do
- Authenticate a CI runner to Snowflake with a service user and workload identity federation
- Apply Snowflake CLI connection precedence and snowflake.yml env variables across environments
- Map the validate, deploy and verify pipeline stages to Snowflake CLI commands
- Promote ML assets with DCM projects and model registry default versions and aliases
1.Authenticating a CI runner with a service user
Snowflake CLI is the automation layer for CI/CD. It can deploy DCM projects, Snowpark applications, Native Apps and standalone SQL scripts. Snowflake maintains first-party integrations that install the CLI on the runner and configure authentication. On any other CI system (Jenkins, Bitbucket Pipelines, CircleCI), you install it with a shell command.
| Integration | Status | Recommended authentication |
|---|---|---|
| GitHub Action | Generally available | Workload identity federation (OIDC) |
| GitLab CI/CD Component | Public preview | Workload identity federation (OIDC) |
| Azure DevOps Extension | Public preview | Workload identity federation (OIDC through Azure service connection) |
Every integration follows the same pattern on the Snowflake side. You create a service user for the pipeline, configure how it authenticates, and grant it only the roles it needs. With OIDC, the runner gets a short-lived identity token that Snowflake validates directly, so the CI system stores no long-lived secret. The ISSUER and SUBJECT values depend on the CI platform.
Checkpoint 1 of 7· Fill the gap
Which value configures this service user for workload identity federation?
CREATE USER <username>
TYPE = SERVICE
WORKLOAD_IDENTITY = (
TYPE = ?
ISSUER = '<ci-platform-issuer>'
SUBJECT = '<ci-platform-subject>'
);The WORKLOAD_IDENTITY block uses TYPE = OIDC, along with the issuer and subject claim that the CI platform publishes.
Source: docs.snowflake.comIf OIDC isn't available, use key pair authentication. Store the private key as a CI secret and pass it in through SNOWFLAKE_PRIVATE_KEY_RAW or SNOWFLAKE_CONNECTIONS_<NAME>_PRIVATE_KEY_RAW. Password authentication still works for legacy workflows but is not recommended for production CI/CD.
Checkpoint 2 of 7· Check yourself
A team's CI runners are on-premises and cannot use OIDC. Which authentication does the Snowflake CLI CI/CD guidance recommend instead?
Key pair authentication is the documented fallback when OIDC is not possible. Passwords are for legacy use only, and credentials should never be committed.
“When OIDC is not available (for example, when you need to support older Snowflake CLI versions or on-premises CI runners), use key pair authentication.”Source: docs.snowflake.com
Sources1
2.Connection precedence and project-definition variables
A typical pipeline commits a config.toml that contains only the connection skeleton and injects secrets through environment variables. When the same setting is supplied in more than one place, these rules decide which value wins:
| Rank | Source |
|---|---|
| 1 | Command-line parameters |
| 2 | Connection-specific environment variables, e.g. SNOWFLAKE_CONNECTIONS_MYCONNECTION_PASSWORD |
| 3 | Values in config.toml |
| 4 | Generic environment variables such as SNOWFLAKE_USER |
Checkpoint 3 of 7· Check yourself
config.toml defines a password for connection MYCONNECTION, and the runner also sets SNOWFLAKE_CONNECTIONS_MYCONNECTION_PASSWORD. No command-line flag is passed. Which value does the CLI use?
Only command-line parameters outrank a connection-specific environment variable, which in turn overrides config.toml.
“Environment variables that target a specific connection parameter (for example, SNOWFLAKE_CONNECTIONS_MYCONNECTION_PASSWORD) override config.toml.”Source: docs.snowflake.com
Values that change between environments, such as the target database or role, go in the env section of the project definition file, snowflake.yml. Commands then refer to them with <% ctx.env.name %>. A shell environment variable with the same case-sensitive name overrides the file's default, so one project definition can serve dev, staging and prod. For example, export database="other" overrides the database value.
definition_version: 2
env:
database: "dev"
role: "eng_rl"snow sql -q "grant usage on database <% ctx.env.database %> to <% ctx.env.role %>"3.Validate, deploy, verify
With authentication and configuration in place, a Snowflake pipeline usually runs three stages. On a pull request it validates, computing the changes without applying them and posting them for reviewers. On merge to main it deploys. Afterwards it verifies, running expectation checks. The pattern is the same on every CI platform. The CLI goes onto the runner with a single install line:
uv tool install snowflake-cli
snow --versionCheckpoint 4 of 7· Match them up
Match each Snowflake CLI command to its role in a pipeline
Tap a term, then the definition that fits it.
Plan belongs to validation, deploy and git execute apply changes, and test confirms the result.
“snow git execute to run SQL files from a Snowflake Git integration.”Source: docs.snowflake.com
Sources1
4.Promoting ML assets: DCM projects and model versions
Snowflake has two native ways to move ML assets toward production.
For objects such as the tables, schemas and roles behind a feature pipeline, DCM projects are declarative. Definition files state the target state, usually in Git, and Snowflake works out the changes needed to reach it. A DCM project is a schema-level object, and you need one for each target environment. It stores the immutable artifacts of every deployment it runs. PLAN previews the changes and DEPLOY applies them. This also takes care of object dependencies: the order and location of DEFINE statements don't matter, because Snowflake sorts them before applying changes.
Checkpoint 5 of 7· Check yourself
A team keeps one set of DCM definition files and promotes them through dev, staging and prod. How many DCM project objects does this require?
Each target environment gets its own DCM project object, which runs the DCM commands and keeps that environment's deployment artifacts.
“You need a DCM project object for each target environment.”Source: docs.snowflake.com
For models, promotion happens in the Model Registry. Models are versioned, and one version is the default. The simplest scheme treats the default version as production, so promoting a version means setting it as the default. A version can also carry an alias, and the system alias DEFAULT always refers to the default version. Both are set with ALTER MODEL:
ALTER MODEL [ IF EXISTS ] <name> SET
[ COMMENT = '<string_literal>' ]
[ DEFAULT_VERSION = '<version_name>']
ALTER MODEL [ IF EXISTS ] <model_name> SET TAG <tag_name> = '<tag_value>'
ALTER MODEL [ IF EXISTS ] <model_name> UNSET TAG <tag_name> [ , <tag_name> ... ]
ALTER MODEL [ IF EXISTS ] <model_name> VERSION <version_name> SET ALIAS = <alias_name>
ALTER MODEL [ IF EXISTS ] <model_name> VERSION <version_or_alias_name> UNSET ALIASCheckpoint 6 of 7· Check yourself
Production code calls a model without naming a version. Under the default-version scheme, how is a new version promoted?
Calls made directly on the model run against the default version, so changing DEFAULT_VERSION is the promotion step.
“you promote a model version to production simply by setting it as the default”Source: docs.snowflake.com
Checkpoint 7 of 7· Exam question
Which path correctly runs a training-setup script from a release tag named `v2.1.0` in the Git repository object `ml_repo`?
Correct answer: A — `EXECUTE IMMEDIATE FROM @ml_repo/tags/v2.1.0/deploy/setup.sql`
- A. Correct. Repository content is addressed as `@repo/tags/<tag>/`, `@repo/branches/<branch>/`, or `@repo/commits/<sha>/`.
- B. Incorrect. The commits segment expects a commit SHA, not a tag name.
- C. Incorrect. There is no releases segment in Git repository paths; only branches, tags, and commits exist.
- D. Incorrect. The branches path resolves branch names; a tag name placed there is not found unless a branch has that name.
Exam traps
Each one states something that sounds right. Open it to see what is actually true.
1.DEFINE statements in a DCM project must be ordered so that dependencies are created first.Why is that wrong?
Snowflake collects and sorts all DEFINE statements before applying them, so file order and placement don't affect the result.
Covered in Promoting ML assets: DCM projects and model versions
2.Storing a service user's password or private key as a CI secret is the recommended way to authenticate GitHub Actions.Why is that wrong?
The recommendation is workload identity federation with OIDC, which uses short-lived tokens. Long-lived credentials are the fallback.
3.A committed config.toml should hold the full connection, including credentials, so every runner works the same way.Why is that wrong?
Commit only the connection skeleton and supply secrets through environment variables.
Covered in Connection precedence and project-definition variables
Sources
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“With OIDC, the CI runner obtains a short-lived identity token that Snowflake validates directly.”
↩︎ Authenticating a CI runner with a service user“Create a service user that the pipeline authenticates as.”
↩︎ Authenticating a CI runner with a service user“Command-line parameters override everything.”
↩︎ Connection precedence and project-definition variables“A Snowflake CI/CD pipeline typically progresses through three stages: validate proposed changes on a pull request, deploy them on merge, and verify the result.”
↩︎ Validate, deploy, verify“Use workload identity federation (OIDC) wherever your CI system supports it. Avoid storing long-lived credentials in CI secrets.”
↩︎ Exam trap 2“Do not commit config.toml files that contain credentials.”
↩︎ Exam trap 3“When OIDC is not available (for example, when you need to support older Snowflake CLI versions or on-premises CI runners), use key pair authentication.”
↩︎ Checkpoint“Environment variables that target a specific connection parameter (for example, SNOWFLAKE_CONNECTIONS_MYCONNECTION_PASSWORD) override config.toml.”
↩︎ Checkpoint“snow git execute to run SQL files from a Snowflake Git integration.”
↩︎ Checkpoint - 2.https://docs.snowflake.com/en/developer-guide/snowflake-cli/project-definitions/create-templatesOfficial docs
“by setting a shell environment variable by the same case-sensitive name”
↩︎ Connection precedence and project-definition variables - 3.
“The DCM project object is used to execute DCM commands and stores the immutable artifacts and definition files of all executed deployments.”
↩︎ Promoting ML assets: DCM projects and model versions“Snowflake collects and sorts all statements before applying changes, so you don’t need to manually handle sequencing or dependencies.”
↩︎ Exam trap 1“You need a DCM project object for each target environment.”
↩︎ Checkpoint - 4.
“The system alias DEFAULT refers to the default version.”
↩︎ Promoting ML assets: DCM projects and model versions
Also cited
- https://docs.snowflake.com/en/developer-guide/snowflake-ml/model-registry/model-managementOfficial docs
“you promote a model version to production simply by setting it as the default”
↩︎ Checkpoint