We have been deploying packages to a Dynamics 365 Finance & Operations (F&O) environment using the artifacts generated from our Azure DevOps build pipeline. The deployment process is
- Download the package from the Azure DevOps build pipeline.
- Upload the package to the LCS Asset Library.
- Log into the target F&O environment and manually perform the following actions:
- Change the status of all batch jobs from Waiting → Withhold (only for jobs run by users who are not admins and jobs created on the current day).
- Stop all queue scanners in all legal entities.
- Deploy the package using LCS. After deployment, revert the changes:
- Change batch jobs back from Withhold → Waiting.
- Restart all queue scanners in all legal entities.
This manual process is time-consuming and prone to errors. While I use the LCS extension in Azure DevOps along with LCS Asset Upload and Deploy Tasks for test environments, in production environments, the above manual steps are mandatory before deployment.
I understand that the OData API can be used to automate batch job and queue scanner management, but I am unsure how to proceed. I am looking for solutions on:
Which OData API endpoints to use for managing batch jobs and queue scanners. How to structure the API calls to filter and update only the relevant batch jobs (those run by non-admins and created today). Any PowerShell or script-based automation that can be integrated into Azure DevOps to execute these steps seamlessly. If anyone has experience automating this process or can provide code snippets, best practices, or references, it would be appreciated!