Lone Badger Tech

Environments

bsm.yaml: dev, test, prod and everything that differs between them.

bsm.yaml
provider: sqlserver
defaultEnvironment: dev                # also: BSM_ENV, or --env / -e

variables: {}                         # see Variables

environments:
  _azure:                              # '_' prefix: template, used only through extends
    database: App
    tls: { mode: strict }
    authentication: entraInteractive
    entra: { tenantId: 7f3c1e2a-0000-0000-0000-000000000000 }

  dev:
    extends: _azure
    host: myapp-dev.database.windows.net

  prod:
    extends: _azure
    description: Production
    host: myapp-prod.database.windows.net
    protected: true
    allowRevert: false
    ordering: strict

Inheritance

extends names another environment (or template) to start from. Maps merge key by key, so entra: in a child adds to the template's entra:; values and lists are replaced. Chains are allowed, cycles are errors. bsm env show -e prod prints the merged result with secrets masked; bsm env list shows every environment.

Settings

KeyDefaultMeaning
descriptionShown in env list; {env.description}
host, port, databaseport 1433Where to connect
connectionStringRaw SqlClient connection string; the fields above override it
authentication, user, password, entraAuthentication
tls, connectionProperties, sshConnection settings
protectedfalseDeploy, revert, rebase, baseline and destructive provisioning require typing the environment name, or --yes
allowReverttruefalse refuses revert and rebase
orderingdependencydependency or strict (Teams)
stateSchemabsmSchema for the journal tables
commandTimeoutSecondsdriver default (30)Per-batch timeout
lockTimeoutSeconds300Wait for another deployer
variablesEnvironment-specific variables
alwaysEncryptedAlways Encrypted keys
schemaFingerprintpartitionBoundaries: ignore for databases whose partitions a job splits and merges (Partitions)

Unknown keys inside known blocks (for example a misspelled entra.tennantId) are errors, so typos never silently fall back to defaults.

Secrets

Any value can reference ${env:NAME} (an environment variable) or ${file:path} (a file, such as a mounted secret). They are resolved only for the environment being used, so a missing production secret never breaks a dev run. Never commit passwords; bsm.yaml belongs in source control.

Database ownership

The first deploy records the environment name in the database. If you later run as a different environment against that database (for example prod settings pointing at a test server after a copy-paste mistake), bsm refuses:

error: This database belongs to environment 'test', but you are running as 'prod'. Check --env and the
connection settings. If the database was intentionally copied (e.g. prod restored into test), pass --claim-environment.

--claim-environment re-records the database under the new name. Every journal event also records the environment that wrote it.

Environment-only scripts

See Repeatables: environments/<name>/**/*.sql runs only there.