DrJohnT / AzureDevOpsExtensionsForSqlServer

Microsoft SQL Server deployment extensions for Azure DevOps Pipelines
MIT License
21 stars 14 forks source link

Enhancement | Allow SQL Username and Password #13

Closed BevanG closed 3 years ago

BevanG commented 4 years ago

Would it possible to pass through SQL Username and Password? This would allow the Extension to use both Integrated security (as it does now) and sql authentication with a minor change.

It could look something like:

foreach ($SqlCmdFile in $SqlCmdFiles) {
    $Command = {Invoke-Sqlcmd -Server $Server -Database $Database -InputFile $SqlCmdFile -QueryTimeout $QueryTimeout -ErrorAction Stop}
    # Now Invoke-Sqlcmd for each script in the folder
    Write-Host "Running SQLCMD file:   $(Split-Path -Leaf $SqlCmdFile)"
    if ($SqlCmdVariableType -ne 'none') {
        $Command = "$Command -Variable $SqlCmdVariables"
    }
    if ($SqlCmdUsername -ne 'none') {
        $Command = "$Command -Username $Username -Password $Password"
    }   
    Invoke-Command -ScriptBlock $Command
}
fakhrulhilal commented 4 years ago

I was about asking the same issue. So adding this feature will be great.

abdullahamjad786 commented 4 years ago

Hi Everyone, Can you tell is this issue fixed? I want to add Sql Server Username and Password in this Task. So what is Possible work around for it?

DrJohnT commented 3 years ago

This functionality has now been added to the extension. Please use v1.1.x of the extension.