Skip to content

Allow for AAD username and password login #60

@vermegi

Description

@vermegi

The underlying SQLCMD tool allows for login to SQL Server by using an AAD username and password combination or even doing integrated login. This is currently not supported by the GitHub sql-action, since the -G switch is not used for AAD login.

I am currently working on a fully automated setup of an Azure SQL Server database fronted by a web app. Code for this can be found at: https://github.com/Azure-Samples/app-service-networking-samples

However I am bumping in the following restrictions for fully automating this flow:

  • I need to use AAD credentials to be able to allow for mi.sql script, since the script executes CREATE USER accountName FROM EXTERNAL PROVIDER; this needs to be done from logged in AAD account
  • I cannot login with AAD credentials through sql-action

I tried using:

     connection-string: ${{ format('Server={0};Initial Catalog={1};User Id={2};Password={3};AUTHENTICATION = ActiveDirectoryPassword', steps.deploy.outputs.sqlServerFullyQualifiedDomainName, steps.deploy.outputs.databaseName, secrets.AAD_USERNAME, secrets.AAD_PASSWORD) }}

However, the AUTHENTICATION = ActiveDirectoryPassword gets ignored.

On execution I get a 'Failed to add firewall rule', from sqlutils.ts file. However, there the login is done without the -G switch for SQLCMD and hence failing for AAD accounts.

Could be that this same issue exists deeper in the code on execution of the actual SQL command, currently I get a failure on FW settings.

Additionally making this integrated AAD login would be nice as well for people wanting to use account of the runner for log in.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions