Store Snapshots, Diffs, and SQL Output from Liquibase in Azure Blob Storage
Last updated: July 14, 2025
Liquibase can generate output files during certain commands, such as snapshots, diffs, and files with SQL commands. By using Azure Blob Storage as the destination for these files, you can centralize artifacts for auditing, collaboration, and CI/CD workflows.
This article shows you how to store files Liquibase generates directly in Azure Blob Storage using the --output-file option. You’ll learn which commands produce these outputs, when to use them, and how to specify an Azure storage path using the az:// URL format.
Before you begin
Confirm that you've installed Liquibase 4.32.0+ and have a Liquibase Pro license.
Confirm that you have an Azure storage account.
Install the Liquibase Azure extension.
Apply your Liquibase Pro license key.
Connect Liquibase to Azure Blob Storage.
Procedure
Liquibase can generate several types of output files that help you analyze or preview database changes. By using the --output-file flag with an az:// path, you can store these files directly in your Azure Blob Storage container for centralized access.
Store a snapshot
Use the snapshot
command when you want to capture the current structure of your database as a reference point. This is useful for auditing, version control, or pre-migration analysis.
Before you run the example code, be sure to:
Replace your_blob_container with the name of your blob storage container in Azure where you would like to upload the file.
Replace test-snapshot.json with your preferred output file name, if desired.
Example Code
liquibase snapshot \
--snapshot-format=json \
--output-file="az://your_blob_container/test-snapshot.json"
Store a diff
The diff command compares two databases and generates a difference report. It’s commonly used at the end of a project to verify that all changes are captured in the changelog, or to detect drift between an expected schema and the actual state of a database.
Before you run the example code, be sure to:
Replace your_blob_container with the name of your blob storage container in Azure where you would like to upload the file.
Replace
test-diff.txt
with your preferred output file name, if desired.Update the --reference-url value to match the connection string for your reference database. This is the source database you want to compare from.
Update the --url value to match the connection string for your target database. This is the database you are using to compare against.
Example Code
liquibase diff \
--reference-url=jdbc:h2:mem:reference \
--url=jdbc:h2:mem:target \
--output-file="az://your_blob_container/test-diff.txt"
Store SQL output
The updateSQL
command generates the SQL statements from the changelog and saves them as a preview file, rather than running them on a database. This is often used for code review, audits, or manual application in locked-down environments.
Before you run the example code, be sure to:
Replace your_blob_container with the name of your blob storage container in Azure where you would like to upload the file.
Replace your_changelog.sql with the file name for your changelog file.
Replace update-preview.sql with your preferred output file name, if desired.
Note: This example assumes you already have a changelog file stored in an Azure Blob container that you would like to use. You can also reference a changelog from a local directory.
Example Code
liquibase updateSQL \
--changelog-file=az://your_blob_container/your_changelog.sql \
--output-file="az://your_blob_container/update-preview.sql"