d365collaborative / d365fo.tools

Tools used for Dynamics 365 Finance and Operations
MIT License
250 stars 102 forks source link

Import-D365Bacpac generate Set-SqlBacpacValues : Cannot bind parameter because parameter 'TrustedConnection' is specified more than once. #765

Closed TrudAX closed 1 year ago

TrudAX commented 1 year ago

When I tried to run the following command(to restore Tier2 to Tier1) on the latest .72 version

Import-D365Bacpac -BacpacFile $filePathpac -ImportModeTier1 -NewDatabaseName $fileDB

I got the following exception:

Set-SqlBacpacValues : Cannot bind parameter because parameter 'TrustedConnection' is specified more than once. To provide multiple values to parameters that can accept multiple values, use the array syntax. For example, 
"-parameter value1,value2,value3".
At line:19940 char:44
+         $res = Set-SqlBacpacValues @Params -TrustedConnection $UseTru ...
+                                            ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Set-SqlBacpacValues], ParameterBindingException
    + FullyQualifiedErrorId : ParameterAlreadyBound,Set-SqlBacpacValues

the import seems working, so just an exception is generated I do not use Set-SqlBacpacValues anywhere, so the call seems to be inside the import

Expected results: The exception should not be displayed

FH-Inway commented 1 year ago

Sorry, that was my bad. As part of https://github.com/d365collaborative/d365fo.tools/pull/760/commits/94a46bf83807f8f9e2e6f8d6f05dcee71fd765e4, I did some refactoring and made a mistake. Should be fixed by #767

As a workaround till the fix gets released, to prevent the exception, run Import-D365Bacpac with the -ImportOnly switch or go back to version 0.7.1 or an earlier version.