Skip to content
  • There are no suggestions because the search field is empty.

Snowflake - Deployment with an Azure Pipeline

Applies to
Platform: Snowflake

Deploy the artifacts of a Snowflake project from its Git repository with an Azure DevOps pipeline. The pipeline task of the biGENIUS-X deployment extension installs SnowSQL, replaces the placeholders and runs deploy.ps1. Afterwards every push that changes the folder artifacts deploys the project.

Prerequisites

Prepare the repository and Snowflake

  1. Download the artifacts and enter your values in replacement_config.json, as described in Replace the placeholders in the artifacts with the Snowflake placeholder values.
  2. Upload this replacement_config.json to the root folder of the feature branch that contains the pushed artifacts, not into the folder artifacts. The next push of generated artifacts replaces the files in artifacts.
    Azure Repos Files view of the feature branch with the folder artifacts and the file replacement_config.json in the root folder
  3. Merge the feature branch into the main branch, see Start a pull request for a Local Branch.
  4. In Snowflake, let the pipeline user's tokens bypass the network policy evaluation. By default, Snowflake accepts a programmatic access token only from a user who is subject to a network policy:
    USE ROLE ACCOUNTADMIN;
    CREATE OR REPLACE AUTHENTICATION POLICY
      <database>.PUBLIC.PIPELINE_TOKEN_POLICY
      PAT_POLICY = (
        NETWORK_POLICY_EVALUATION = NOT_ENFORCED,
        REQUIRE_ROLE_RESTRICTION_FOR_SERVICE_USERS = FALSE
      );
    ALTER USER <user> SET AUTHENTICATION POLICY
      <database>.PUBLIC.PIPELINE_TOKEN_POLICY;
    Here <database> is a database that holds the policy, and <user> is the pipeline user.
  5. Create a programmatic access token for the user and save it; Snowflake shows it only once. DAYS_TO_EXPIRY sets its validity, 15 days by default and up to 365:
    ALTER USER IF EXISTS <user>
      ADD PROGRAMMATIC ACCESS TOKEN BIGENIUS
      DAYS_TO_EXPIRY = <days>;

Create the pipeline

Variable group

  1. In Azure DevOps, open Pipelines and choose Library.
    Azure DevOps Pipelines menu with the Library option highlighted
  2. Select + Variable group and enter a name, for example PIPELINE-SNOWFLAKE.
    Library page with the Variable group button highlighted
  3. Add the variables SNOWFLAKE_ACCOUNT (the account identifier, for example <organization>-<account>), SNOWFLAKE_USER (the pipeline user) and SNOWFLAKE_PASSWORD (the token). Select the lock icon of SNOWFLAKE_PASSWORD to make it secret, then save the group.

Pipeline

  1. Open Pipelines, choose Pipelines and select New pipeline.
    Azure DevOps Pipelines menu with the Pipelines option highlighted
    New pipeline button
  2. At Where is your code, choose Azure Repos Git, and at Select a repository, select the repository of the project.
    New pipeline page Where is your code with Azure Repos Git highlighted
    New pipeline page Select a repository with the filtered repository highlighted
  3. At Configure your pipeline, choose Starter pipeline.
    New pipeline page Configure your pipeline with Starter pipeline highlighted
  4. Select Show assistant and search for bigenius. The task biGenius Snowflake Deployment, identifier biGeniusSnowflakeDeployment@1, shows that the extension is available.
    Show assistant button
    Tasks assistant search for bigenius showing the Databricks, Fabric and Snowflake deployment tasks
  5. Replace the starter code with this pipeline, with your variable group name:
    trigger:
      paths:
        include:
          - artifacts/**
    
    pool:
      vmImage: windows-2025
    
    variables:
      - group: PIPELINE-SNOWFLAKE
    
    steps:
    - task: biGeniusSnowflakeDeployment@1
      inputs:
        EnvironmentName: 'DEV'
        ReplacementConfigPath: '../replacement_config.json'
        Account: '$(SNOWFLAKE_ACCOUNT)'
        Password: '$(SNOWFLAKE_PASSWORD)'
        User: '$(SNOWFLAKE_USER)'
    The trigger runs the pipeline after every push that changes a file in the folder artifacts, so every push of generated artifacts deploys them. The generated replacement_config.json names its environment DEV, the value of EnvironmentName.

    With the default Deployment Options, Generate Drop Table Statements and Generate Drop Load Control Schema are selected. Each deployment replaces every generated table, which deletes its data, and drops the load control schema with all objects in it. Before you deploy to a database that holds data, clear both options in Project Settings and generate the artifacts again.

  6. Select Save and run, then Save and run in the dialog that opens. The pipeline starts.
    Save and run button

Check the result

  1. Open the run and select the job. On the first run, the job waits for permission to use the variable group: select View, then Permit, and confirm with Permit.
    Pipeline run summary with the queued job Job in the Jobs list
    Pipeline job waiting for permission to access a resource, with the View button
    Checks and manual validations dialog with the Permit button for the variable group
    Permit access confirmation dialog with the Permit button
  2. Follow the job. Its task installs SnowSQL, replaces the placeholders in the folder artifacts and runs deploy.ps1. The job succeeded when every step shows a green check.
    Completed pipeline job steps including checkout and the biGENIUS Snowflake deployment task
  3. Check the objects in Snowflake as described in Snowflake - Deployment. With more than one native option in LoadControl Options, the pipeline creates no tasks; deploy the task script as described there.

Failure symptoms and recovery

The job waits for permission

Cause: A new pipeline needs permission to use the variable group.
Fix: Select View and Permit in the job, as in Check the result.

For failures in other steps, see Troubleshoot generation, deployment and load failures.

Related articles