Snowflake CLI Azure DevOps Extension¶
The Snowflake CLI Azure DevOps Extension (snowflakedb/snowflake-ado-extension) installs and configures Snowflake CLI in an Azure Pipelines pipeline. Use it to automate Snowflake deployments (DCM projects, Snowpark applications, Snowflake Native Apps, and SQL scripts) from your Azure DevOps project.
How it works¶
The extension publishes a single pipeline task, ConfigureSnowflakeCLI@0. The task performs these steps on the agent:
Installs Snowflake CLI in an isolated environment using
pipx(pipx install snowflake-cliorpipx install snowflake-cli==<version>).Copies the
snowexecutable to a known location and prepends it to the pipeline’sPATH.Copies
config.tomlfrom the repository to~/.snowflake/config.toml(0600on Linux/macOS). Skipped if the file is absent.When workload identity is enabled, requests an OIDC token from Azure DevOps through the specified service connection and sets the Snowflake workload identity environment variables for subsequent steps.
After the task completes, the snow command is available on PATH for every subsequent step in the job. On Windows agents, both snow and snow.exe are available.
Quick usage example¶
The following pipeline authenticates with Snowflake using workload identity federation (WIF) through an Azure Resource Manager service connection and runs a connection test:
Inputs¶
The task accepts the following inputs, specified under inputs: in your pipeline YAML:
Input |
Required |
Default |
Description |
|---|---|---|---|
|
Yes |
|
Snowflake CLI version to install, for example |
|
No |
|
Path to your |
|
No |
|
When |
|
Conditional |
(none) |
Name of the Azure Resource Manager service connection. Required and shown in the pipeline editor only when |
Authentication methods¶
The task supports three ways of authenticating with Snowflake. Snowflake recommends workload identity federation because it avoids storing long-lived secrets in Azure DevOps.
Method |
Security |
Notes |
|---|---|---|
Workload identity federation (WIF) with OIDC (recommended) |
Secretless, short-lived tokens |
Requires an Azure Entra ID App Registration with a federated credential and an Azure Resource Manager service connection. |
Private key stored in pipeline variables/secrets |
Works with any Snowflake CLI version. Combined with |
|
Password stored in pipeline variables/secrets |
Legacy option, not recommended for production pipelines. |
Workload identity federation (WIF) with OIDC¶
With WIF, Azure DevOps obtains a short-lived OIDC token through the configured Azure Resource Manager service connection, and Snowflake validates the token directly. No private key or password is stored in Azure DevOps.
Create the service user¶
Create a Snowflake service user that trusts Azure DevOps OIDC:
The ISSUER incorporates your Azure AD tenant ID, and the SUBJECT uses the Azure DevOps service connection identifier format (sc://<org>/<project>/<connection>). The OIDC_AUDIENCE_LIST must be api://AzureADTokenExchange.
Configure the task¶
Create an Azure Resource Manager service connection with a federated credential that trusts Snowflake’s audience (see the Azure documentation on workload identity federation with Azure DevOps), then reference the service connection from the task:
When useWorkloadIdentity: true is set, the task exports the following environment variables for subsequent steps:
SNOWFLAKE_AUTHENTICATOR=WORKLOAD_IDENTITYSNOWFLAKE_WORKLOAD_IDENTITY_PROVIDER=OIDCSNOWFLAKE_TOKEN=<oidc-token>(marked as a pipeline secret)
For broader context, see Workload identity federation.
Key pair authentication¶
Store your Snowflake private key as an Azure DevOps secret variable and pass it through the environment. You can use a temporary connection (no config.toml required) or a named connection defined in config.toml.
For connection-file-based authentication, commit a config.toml with an empty connection block and supply the credentials through SNOWFLAKE_CONNECTIONS_<NAME>_* environment variables. See Managing Snowflake connections.
Password authentication¶
Password authentication is supported for legacy workflows but is not recommended for production CI/CD. Unset SNOWFLAKE_AUTHENTICATOR and pass SNOWFLAKE_PASSWORD:
Note
When using a password and MFA, Snowflake recommends enabling MFA caching.
Platform support¶
The task runs on Linux, macOS, and Windows Azure Pipelines agents. Note the following platform-specific behavior:
Linux and macOS: the copied
config.tomlis set to0600permissions. Thesnowexecutable is available onPATH.Windows: file permissions on
config.tomlare not modified. Bothsnowandsnow.exeare available onPATH.
The task runs on the Node 16 agent runtime.
Using a pre-installed Snowflake CLI¶
If Snowflake CLI is already installed on a self-hosted agent image (for example, baked into a custom agent pool), set the DISABLE_SNOW_INSTALLATION_WITH_PIPX environment variable on the task to skip the pipx installation step:
The task still copies your config.toml and configures authentication. You are responsible for ensuring snow is on PATH and that the version matches the one declared in cliVersion.