In D365 finance and operations - On-Premise, there should be an option to run script to apply custom package on the environment from the asset library and also can get status update. This will help in automating the process by continuously checking the status of package deployment rather logging into web page for LCS and click "Prepare" and "Update environment" buttons. The deployment happens in non-business hours which takes around 2-3 hours on one environment. By using Azure Powershell scripts, keep on checking the status and pressing the button manually will not be required. This can be restricted, when package is successfully prepared then only package can be applied. And if package deployment fails there should be a script to Rollback or Retry the process.