While working with Dynamics 365 for Finance and operation implementation it’s a common requirement to take a database back up from tier 2 environments and restore it to Dev (Tier 1) environments.

The standard procedure we follow to restore DB is get bacpac file from sandbox environments using LCS and use following command to restore it on Dev enviornment.

SqlPackage.exe /a:import /sf:J:\Exportedbacpac\AxDBUAT_20211109.bacpac /tsn:localhost /tdn:AxDB /p:CommandTimeout=1200

Remember , SqlPackage.exe/ DAC framework  can be installed through this link.

And then you should be able to find it in following folder in your dev box – C:\Program Files\Microsoft SQL Server\160\DAC\bin or C:\Program Files (x86)\Microsoft SQL Server\160\DAC\bin.

However, with the recent release of dc framework default connection settings are changed to improve default security connections. So, if you try to run the existing command stated above you will get an error or warning as shown in below image.  

A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 – The certificate chain was issued by an authority that is not trusted.)

The certificate chain was issued by an authority that is not trusted.

Starting with version 161 of DacFx and SqlPackage, database connections are encrypted by default and server certificates must be signed by a recognized certificate authority.

You can leverage following command line parameters to alter a database connection:

  • /SourceEncryptConnection (default True)
  • /SourceTrustServerCertificate (default False)
  • /TargetEncryptConnection (default True)
  • /TargetTrustServerCertificate (default False)

So, you should modify your command to import/restore DB on D365 F&O tier 1 to include TargetTrustServerCertificate:True.

You can use below command to restore DB on tier 1 environments

SqlPackage.exe /a:import /sf:J:\Exportedbacpac\HSMUATbackup.bacpac /tsn:localhost /tdn:AxDBCopy /p:CommandTimeout=1200 /TargetTrustServerCertificate:True

That’s all for now. You can refer this link to know more about this release.