Maintenance Mode Exception

Batch Service Exception (Maintenance Mode) D365FO



Recently, My office colleague faced an issue while starting  Microsoft D365 windows batch services in Update 15. after 10 seconds of processing it's getting failed 



When we check in Event Viewer with below Path

Application and services Logs > Microsoft > Dynamics > AX-BatchService > Operations



Batch service throwing below Error 


After spending some hours on the internet root cause was found. this issue occurs When D365FO is On Maintenance Mode.

There are two ways to fix this issue...

The proper way; Use the Microsoft.Dynamics.AX.Deployment.Setup.exe command; 

Run this from the command line:

C:\AOSService\PackagesLocalDirectory\Bin\Microsoft.Dynamics.AX.Deployment.Setup.exe –metadatadir C:\AOSService\PackagesLocalDirectory –bindir C:\AOSService\PackagesLocalDirectory –sqlserver . –sqldatabase axdb –sqluser AOSUser –sqlpwd AOSWebSite@123 –setupmode maintenancemode –isinmaintenancemode false 


The Hack way; Use the Microsoft SQL Server Management Studio, and edit the following record in the table dbo.SQLSystemvariables ; CONFIGURATIONMODE

Update SQLSystemvariables set Value=0 where parm='CONFIGURATIONMODE'


BYOD (Bring your own database) D365FO




What is BYOD?

The BYOD feature was released in Microsoft Dynamics 365 with platform update 2 (August 2016)
BYOD feature lets administrators configure their own database, and then export one or more data entities that are available in Finance and Operations into it.
The BYOD feature allows you to push data into a database that you manage on Azure or on-premises.
This is done with the use of data entities. This means you can use existing entities or build your own entities to structure the data how you need for your external database. As per MSFT, Currently, more than 1700 Data entities are available.


Objective 

You have data in D365 running in the cloud but you still have other applications that you run on-premise or somewhere else. 

So you need to get data from D365 into another environment so other applications can use the data. 

The most common use of BYOD is for data analysis and long-running reporting (Long-running reports are the pain point of AX)


Prerequisite


First Create a database on Azure SQL or on-premise SQL (You need static IP for connection)

How to create a Database on Azure.

Log in to the Azure portal



Follow these steps to create a blank SQL database.
  1. Click Create a resource in the upper left-hand corner of the Azure portal.
  2. On the New page, select Databases in the Azure Marketplace section, and then click SQL Database in the Featured section.


Fill out the below fields.



Click on a server to configure server for you newly created database a pop will appear to fill the required information 



Once the database is created on SQL or AZURE Then log in to D365 to configure the data source of the Newly created database. for Azure database detail please follow this link


AX Data source Configuration.



 Go to Systems Administrations > Workspace > Data management 

Click on > Configure Data Source and click on New




Now fill in the data source name and description and select the type Azure SQL DB.

Please check the below screenshot.




Now Go back to Systems Administrations > Workspace > Data management 

Click on > Configure Entity export to database




Now, click on the EDIT button to Edit the newly  created data source.


Enter Azure SQL / SQL connection string and click on validate 





Then enter the connection string of the Azure DB.
It should be in the format:
Data Source={azure.database.windows.net},1433;Initial Catalog={database};Integrated Security=False;User ID={userid};Password={password}
Configuration of data source is completed.

Now Go back to Systems Administrations > Workspace > Data management 

Click on > Data Entities


If Entities are not showing then go back to Systems Administrations > Workspace > Data management and click on framework parameters and refresh the entities 



After 2 or 3 minutes all entities will appear on your Data Entities List page.
Now select the required Entity which you want to export. 

Enable the change tracking for incremental Export.




Once Change Tracking Enable on Entity click on Publish then select your data source where you want to publish and click on publish 




A Job Will schedule like the below screenshot 


The message will appear once the job is complete and a table will be created for targeted DB.

Now Go back to Systems Administrations > Workspace > Data management 

Click on > Export Data 

Please make sure you always use Enhance View for Import and Export



Now fill the required fields Like Name and Select Target data format to your Data source, Default refresh type should be incremental then click on Add 




Once you fill all the required fields, You are ready to export :) Make sure you are exporting the data in batch for better performance.


After completion of data export, you can verify your targeted data source Like below screenshot





Please feel free to contact me if you are facing any issues implementing the above blog.







Virtual Fields Vs Computed Fields

  Virtual Field: A virtual field in D365FO is a field that doesn't have a direct representation in the database. It's a field that y...