Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 remove duplicate -TrustedConnection parameters #767

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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