Dynamics 365 F&O: Debugging Batch Jobs using just-in-time database access
Several times, colleagues have asked me how to debug batch jobs using just-in-time database access, and yesterday, I was asked the same thing again. Given how often this comes up, I’m convinced it’s either difficult to find online or the available information isn’t very clear. So, I decided to write this post to save everyone time. Next time, I’ll just send them a link!
Microsoft’s article "Debug a copy of the production database" outlines how to approach debugging batch jobs. Here’s a key point from that article:
If you need to debug batch jobs on a DevTest machine, you might need to restart the batch service, so it appears as an option in Visual Studio for debugger attachment. Additionally, isolating the DevTest machine into its own batch group can help ensure the jobs you want to debug will run on that machine.
However, this advice doesn’t fully apply to the latest versions of F&O. We no longer have the ability to assign a specific AOS to a batch group, which makes it impossible to ensure that a batch job will run on the desired DevTest machine using this method.
So, what’s the solution? The only workaround I know is to manually disable all other batch servers except the one you need. Unfortunately, you can’t do this through the Server configuration form.
Instead, you’ll have to use the Table Browser or directly modify the database.
Once you've disabled the unnecessary batch servers, you can proceed with debugging the batch processes using just-in-time database access.
Disclaimer: The methods described in this blog are based on current knowledge and practices. Modifying database settings or server configurations can have unintended consequences. Proceed at your own risk, and ensure you have appropriate backups.