microsoft / go-sqlcmd

The new sqlcmd, CLI for SQL Server and Azure SQL (winget install sqlcmd / sqlcmd create mssql / sqlcmd open ads)
https://learn.microsoft.com/sql/tools/sqlcmd/go-sqlcmd-utility
MIT License
323 stars 56 forks source link

SQLCMD Create User and Password #490

Open dlevy-msft opened 6 months ago

dlevy-msft commented 6 months ago

Imagine a sample that tries to setup a developer’s environment with one, two, or three different containers – only one is SQL. Docker commands are enough, but sqlcmd is easier – or at least could be. To do this, the password to access SQL will be key.

The requirement would simple be:

  1. Allow a known password to be passed in.
  2. Allow a generated password to be extracted. (not in an interactive way, but a programmatic way)
stuartpa commented 5 months ago

We are looking at solving this with add-ons (in the same way Azure Container Apps does), so secret management is completely abstracted away from the user. There is a rough POC of this in #319 that can be used for demo purposes:

e.g the command:

sqlcmd create mssql --use https://github.com/stuartpa/DabBlazorSamplePages.git --add-on dab --open vscode

Sets up an environment (a sqlconfig context) with two containers, one SQL Server container, and one Azure Data Builder container. The password management is done for you by sqlcmd. This command line goes onto clone the sample repo, and loads VS Code, all the user has to do to launch the application is press F5 in VS Code.

To clean up all the containers, the use just does "sqlcmd delete"

e.g. the command:

sqlcmd create mssql --use https://github.com/stuartpa/DabBlazorSamplePages.git --add-on dab --add-on fleet-manager --open vscode

Sets up an environment (a sqlconfig context) for a multi-tenant application, using three containers, one SQL Server container, one Azure Data Builder container and one Azure Database Fleet Manager container. The password management is done for you by sqlcmd.