Skip to content

Commit

Permalink
Merge pull request #767 from FH-Inway/fix-trusted-connection-exception
Browse files Browse the repository at this point in the history
🐛 remove duplicate -TrustedConnection parameters
  • Loading branch information
Splaxi authored Oct 23, 2023
2 parents 66147ce + a6f18e5 commit f72776f
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions d365fo.tools/functions/import-d365bacpac.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -326,11 +326,14 @@ function Import-D365Bacpac {
$Params = Get-DeepClone $BaseParams
$Params.DatabaseName = $NewDatabaseName
$Params.TrustedConnection = $UseTrustedConnection
$Params.OutputCommandOnly = $OutputCommandOnly
$Params.LogPath = $LogPath

$SqlPackageParams = Get-DeepClone $Params
$SqlPackageParams.OutputCommandOnly = $OutputCommandOnly
$SqlPackageParams.LogPath = $LogPath
$SqlPackageParams.ShowOriginalProgress = $ShowOriginalProgress

Write-PSFMessage -Level Verbose "Start importing the bacpac with a new database name and current settings"
Invoke-SqlPackage @Params @ImportParams -ShowOriginalProgress:$ShowOriginalProgress
Invoke-SqlPackage @SqlPackageParams @ImportParams

if ($OutputCommandOnly) { return }

Expand Down Expand Up @@ -363,14 +366,14 @@ function Import-D365Bacpac {
else {
Write-PSFMessage -Level Verbose "Building sql statement to update the imported SQL database"

$res = Set-SqlBacpacValues @Params -TrustedConnection $UseTrustedConnection
$res = Set-SqlBacpacValues @Params

if (-not ($res)) { return }
}

if ($ExecuteCustomSQL) {
Write-PSFMessage -Level Verbose -Message "Invoking the Execution of custom SQL script"
$res = Invoke-D365SqlScript @Params -FilePath $CustomSqlFile -TrustedConnection $UseTrustedConnection
$res = Invoke-D365SqlScript @Params -FilePath $CustomSqlFile

if (-not ($res)) { return }
}
Expand Down

0 comments on commit f72776f

Please sign in to comment.