In this post, we will see how we can debug production data from the development environment.
- Dynamics 365 Finance
- Dynamics 365 Supply Chain Management
Note: Dynamics 365 Finance and Operations is now licensed as multi-purpose business applications. As of this writing, customers can purchase Dynamics 365 Finance, Dynamics 365 Supply Chain Management, and Dynamics 365 Commerce applications separately.
There can be many scenarios where we want to get the production dataset to test new features or reports in development.
Before you debug, make sure that UAT and Development environment has the same application version and codebase. And most importantly, don’t run database synchronization from Visual Studio. This might change the UAT database schema and affect the users in UAT.
Below are the steps we need to follow to debug the production dataset.
Refresh sandbox (UAT) environment with production data
Follow this link to overwrite UAT database with the latest production database.
Once this is done, you will have production data running in the UAT environment.
UAT: A Sandbox Standard Acceptance Test environment that uses Microsoft Azure SQL Database as it’s database platform.
Enable sandbox azure SQL database to be connected with the development environment
The process is called IP Whitelisting. By default only the sandbox AOS server can access this azure SQL database because of firewall rules in place. In order to access the UAT database from Development sever, we need to add our development VM’s IP address to the azure SQL database server whitelist.
Login to your development server and obtain an IP address. You can get it easily by doing a Google search for “What’s my IP”.
We are going to use this Development Server IP address below while running a SQL query.
Sandbox AOS server:
From the LCS sandbox environment details page, under the Database Accounts section, note the SQL Server Database name, password for user name axdbadmin.
On sandbox AOS Server, open SQL Server Management Studio (SSMS) and connect to the Azure SQL server with SQL server name, user name, and password noted above.
Note: in order to complete the SQL server name, suffix .database.windows.net with server name from LCS.
Once connected, execute the following query replacing a.b.c.d with the Development Server IP address we searched above.
This will add your Development Server IP address as a valid IP address to the database server firewall whitelist.
On your development server, open SSMS and try to connect to the same azure sql server using axdbadmin creds we noted above. At this point, you should be able to connect to the sandbox Azure SQL Server database.
Takeaway: Using this process, you can actually access the sandbox database from any machine.
Change development database connection
Now we need to modify the web.config file so that our development Dynamics 365 Finance application can point to UAT database. Once this is done, our dev application local code will be running against the UAT database.
You can find web.config file on the service drive, and in the AoSServiceWebRoot directory. (Typically, the Services drive is drive J or K.).
Open the web.config file in Notepad or another editor, and change the following configurations:
Save the file and restart IIS or IIS Express.
Now that the development environment is configured to use data from UAT. You can go ahead and start debugging the code against this production or sandbox data.