Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Built dbup-cli.exe behaves differently to dotnet tool with az #42

Open
huesie opened this issue Sep 27, 2024 · 0 comments
Open

Built dbup-cli.exe behaves differently to dotnet tool with az #42

huesie opened this issue Sep 27, 2024 · 0 comments

Comments

@huesie
Copy link
Contributor

huesie commented Sep 27, 2024

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:

  1. Ran sudo dbup-cli.exe (and in PowerShell Admin prompt) - doesn't change behaviour.
  2. Setting AzureCLIPath (MSDN_link) and setting envvar etc. - nothing changes behaviour.
  3. Installed az cli in WSL2 and tried to set AzureCLIPath - nothing changes behaviour.
  4. Installed dotnet 6 SDK and installed dbup cli with dotnet tool install --global dbup-cli and using dbup - 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?

  1. I get different behaviour with the pre-built dbup-cli.exe being unable to find az whereas running dbup tool under dotnet 6.0 sdk works as expected - what I can try next please?
  2. Can I trigger additional logging when running dbup-cli.exe to help diagnose this please?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant