Connection to MS SQL Server with an account that has a backslash fails to connect when using DBT_USER='domain\username' as parameter

The problem I’m having

my target database is in Microsoft SQL Server 2019. Our accounts are active directory tied to a domain, so when I try the connection via Terminal in CS Code, it errors because it thinks the \ is an escape character. Example:

What I’ve already tried

the output shows 2 backslashes in the username where the input is just 1. I’ve tried escaping the '' by using 2 backslashes like most apps will allow, but doesn’t seem to work for dbt.

Some example code or error messages

Command being run:

‘dbt_USER=‘domain\testuser’ dbt_PASSWORD=‘testpwd’ dbt docs generate’

Error output:

18:06:29 Encountered an error:
Database Error
(‘28000’, “[28000] [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]Login failed for user ‘domain\testuser’. (18456) (SQLDriverConnect)”)

Does anyone know how to get around this? Or is this just not possible within dbt?

NOTE: I’ve also tried to setup the username in an environment variable, but get the same error.

Any advice is appreciated!