Tuesday, August 29, 2023

How to debug a non-development and a non-production environment In D365 F&O

This post outlines the steps how to debug an issue which is happening in non-development or non-production environments e.g. UAT environment.

Enable access for your IP address

Go to lcs ->sandbox environment page. To connect to test environment RDP, you need to create Whitelist rule for your IP address 



RDP to your environment where you want to debug the issue, with this example I am connecting to UAT (Sandbox). 

Connect to SQL server

a.     Get the server name from LCS database accounts

b.    Use .database.windows.net to connect to database

Create a new SQL sign-in that the developer can use. This step lets the system administrator maintain the security of the sandbox environment. The developer will have access to one database for only a limited time. Use the following code to create the new SQL sign-in.

 

CREATE USER devtempuser WITH PASSWORD = ‘pass@word1’
EXEC sp_addrolemember ‘db_owner’, ‘devtempuser’


Stop following services in development box

a.     IIS or world wide web publishing service development box

b.    Microsoft Dynamics 365 unified Operations: Batch Management service

Go to J:\AosService\WebRoot\web.config.

Save a copy of the original web.config file, so that you can switch back later. I copied file in the same directory and renamed the web.config to webDev.config and copied one to web.config

Edit the following section in the web.config file.

You can either comment original configuration or delete it and add new configuration of the sandbox environment


Start IIS or world wide web publishing service

Do not start batch service otherwise your batch jobs of development box will start writing into UAT environment. Be careful with this step!!!

Now, connect to your development box from browser. Oops!!! It does not connect and throw an error. Don’t worry let’s jump into event log and see what’s in there


Okay; so it is an access issue and here is the resolution for it.

 Whitelist your IP address

 Execute the following command against Master database in UAT database server. IP address you get from the event viewer.

Select new query against Master DB
exec sp_set_firewall_rule N’DEVNAME’, ‘IP’, ‘IP’ 


Note: Restart IIS and make sure application pool is started

Connect to development URL again from browser and this time it works. You can now access UAT database (all legal entities etc.)

Restart or your start your VS in development box and attach to Process w3wp.exe to troubleshoot the issue(s)

 

Done with your debugging and got the resolution 

 

Now it is time to remove devtempuser from UAT database, this prevents having the permanent access to the sandbox database. Right-click on the devtempuser user under Sabndoxdatabase | Security | Users and delete it.

 

Stop IIS.

Revert changes from the web.config file or simply delete the copied one and rename the original one from WebDev to Web.


Start IIS.


Start batch service 


Connect to development environment URL and make sure it is connected to development database.

Reference: 

https://docs.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/dev-tools/debugx-issue-against-copy-of-production






No comments:

Post a Comment