Sunday, March 26, 2023

Dual-write application configuration failed

 Hello D365 Community

Point to remember - We can set up Power Platform Integration only during the deployment of the cloud-hosted environment.  So, Power Platform Integration can't be set up after the developer environment is created.

For example, here is a screenshot of the Dev environment in LCS, for which I had set "Configure Power Platform" to No during the env creation. And because of this, the Dual-Write button is missing:



Ref: Enable Power Platform Integration - Finance & Operations | Dynamics 365 | Microsoft Learn

Now, let's move to main subject. I created a new Cloud hosted env with "Configure Power Platform" set to Yes in the deployment wizard.  This went well and as expected I see "Setup Dual-Write application".




Now that env is created, I performed following actions in the env:
  • Link it to DevOps and got latest code from Dev branch.
  • Restore DB backup from our UAT/Sandbox environment.
  • Compile the whole Application.
  • DB sync

Then in LCS, I clicked the button "Setup Dual-Write application" and after few minutes it failed with this message.

Status:  Dual-write application configuration failed. Please click on resume dual write application to try again.
Failure reason: Script [RefreshAXEntities-AOS-Dev-0] failed execution against VM [ABC-Dev03-1]. Last Result: 0xFFFFFFFF ()




I tried "Resume Dual-Write application" with no success.

Fix:  Enable Change Tracking on the SQL Server DB


ALTER DATABASE AxDB
SET CHANGE_TRACKING = ON  
(CHANGE_RETENTION = 2 DAYS, AUTO_CLEANUP = ON)  


Now on clicking "Resume Dual-Write application", it succeeded.

Here is how I found the root cause: 
  • In the FO application, manually ran the "Refresh Entity List" (Location: Data Management workspace -> Framework parameters -> Entity List)
  • The batch job failed with the error "Change Tracking is not enabled on the database: SQL Server Change Tracking"

 Happy coding