dbup-cli
dbup-cli copied to clipboard
Built dbup-cli.exe behaves differently to dotnet tool with az
Running dbup-cli.exe (in WSL2 or in Windows PowerShell) returns this error:
$ dbup-cli.exe status
Parameters: Connection String: RunAs=Developer;DeveloperTool=AzureCli,
Resource: https://database.windows.net/, Authority: .
Exception Message: Tried to get token using Azure CLI. Access token could not be acquired.
'az' is not recognized as an internal or external command, operable program or batch file.
But running the dotnet tool with SDK 6.0 works fine:
$ dbup status
Database upgrade is required.
You have 1 more scripts to execute.
Things I've tried:
- Ran
sudo dbup-cli.exe(and in PowerShell Admin prompt) - doesn't change behaviour. - Setting AzureCLIPath (MSDN_link) and setting envvar etc. - nothing changes behaviour.
- Installed az cli in WSL2 and tried to set AzureCLIPath - nothing changes behaviour.
- Installed dotnet 6 SDK and installed dbup cli with
dotnet tool install --global dbup-cliand usingdbup- works perfectly: gets the token from az cli and connects.
Contents of .env file to specifically use AzureCli to get token and ignore the other 3 providers:
AzureServicesAuthConnectionString=RunAs=Developer;DeveloperTool=AzureCli
Contents of dbup.yml:
dbUp:
version: 1 # should be 1
provider: AzureSql # DB provider: AzureSql - suppports token auth
connectionString: Server=tcp:MYAZURESQLSERVER.database.windows.net,1433;Database=MYDBNAME;Encrypt=true;
scripts:
- folder: 000-test-scripts-always/ # absolute or relative to folder with *.sql files
subFolders: no # yes / no (default)
order: 000 # script group order, default 100
runAlways: yes # yes / no (default)
A single .sql file 000-test-scripts-always/000-test.sql:
select original_login() as original_login;
go
What is the issue?
- I get different behaviour with the pre-built
dbup-cli.exebeing unable to findazwhereas runningdbuptool under dotnet 6.0 sdk works as expected - what I can try next please? - Can I trigger additional logging when running
dbup-cli.exeto help diagnose this please?