Open yorek opened 1 year ago
what if sqlcmd
dynamically set the initial password or prompted the user to type it? -P
parameters on command lines are frowned upon these days.
Would we need any hint parameters to distinguish a SQL auth user name from a Windows user name from an AAD user name?
That would work too. I would still allow to manually set a password, but I agree to make the default option the autogeneration
You can use the command sqlcmd config add-user
I checked and the problem is with the help documentation. PS is using $Env:VariableName instead of SET VariableName
I manage to add an user with this code:
PS C:\Users\felip> $Env:SQLCMDPASSWORD="Passw0rd"
PS C:\Users\felip> sqlcmd config add-user --name felipe --username felipe --password-encryption none
User 'felipe' added
PS C:\Users\felip>
That doesn't create the login/user in the SQL Server database though.
It would be create if sqlcmd could support the creation of database users/logins. For example, something like
for adding a SQL user into the database pointed at by the active context, or
for adding a AAD user
In both cases the users would be added to the database (creating the login if necessary) and then it would also be stored in the context config so that it could be used when generating the connection string: