Simple restore Bacpac file to AxDB using PowerShell commands

Vasily already described different types of moving DBs (SQL baks and Bacpac files) for tier1 and tier2 in his earlier article here Restore/move D365 database 

Here you can find a specific case for BACPAC files within tier1 using Powershell commands below (in Bold):

  1. Open PowerShell as Administrator:
    If you do not have d356.fo tools installed, first run:  
         Install-Module -Name d365fo.tools
         Invoke-D365InstallSqlPackage

  2. Restore BackPack file:
         Import-D365Bacpac -ImportModeTier1 -BacPacFile "C:/Temp/ NewAxDB.bacpac " -NewDatabaseName " AxDB_new "     -showOriginalProgress

    This process can take up to 2 hours so be patient.

  3. Stop your D365FO services so no active connections are locking your current AxDB:
         Stop-D365Environment
    Open IIS manager / Application Pools / AOSService / Stop.
    If you have open Visual Studio, also quit  IISExpress - right click its icon in the tray (screen bottom left corner, usually inside ^ group) and click Exit.

  4. Switch databases:
          Switch-D365ActiveDatabase -SourceDatabaseName " AxDB_new" -DestinationSuffix " _old"
          Where " _old" is postfix for previously used AxDB so it will be renamed to  AxDB_old. AxDB  is now new active database.

  5. Start your D365FO services:
          Start-D365Environment
           Open IIS manager / Application Pools / AOSService / start
           Close all Visual Studio instances. Re-open Visual Studio.
           In VS go to Extensions > Dynamics 365 > Synchronize database

Search

About

DaxOnline.org is free platform that allows you to quickly store and reuse snippets, notes, articles related to Dynamics AX.

Authors are allowed to set their own AdSense units.
Join us.

Blog Tags