# How to Increase Default Time-out limit for Dual-write Sessions

# Problem statement:
The issue of time-outs for dual-write sessions has been noticed in a couple of scenarios.
# Analysis:
A default time-out of two minutes is not adequate for Dual-write sessions.
# Solution: 
Prerequisites: Dual-write core solution (Anchor solution for Dual-write Core) version **1.0.36**. and later must be installed in Dataverse.

1.	Log in to https://admin.powerplatform.microsoft.com/home
2.	Navigate to Environments
3.	Select your Environment 
![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1660920874007/NKHoA8REV.png align="left")
 
4.	Navigate to Resources and select Dynamics 365 apps
5.	Select “Dual-write core solution”
6.	Click on … and then select details option 
![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1660920985652/I8cpSVObo.png align="left")
7.	Validate version number
 
![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1660920996836/pbgM5KdOB.png align="left")



Let’s understand first, the core of Dual-write

**What is Dual-write?**

Dual-write is an out-of-the-box infrastructure that allows near-real-time bidirectional data integration capability between Dataverse & Dynamics 365 Finance & Operations (ERP).

**How does the data sync mechanism work in a Dual-write statement?
**
By design, as soon as a transactions trigger gets initiated between Dataverse and D365 FO or vice versa immediately data starts getting synchronized unidirectional or bi-directional depending upon how you have set up Dual-write table maps. 

Table maps are the construct that allows the mapping of Dataverse table fields with D365 FO entities fields.

Under the hood, it leverages the Odata technology with a tight coupling of transaction scope to avoid data inconsistency in both apps.
 
# Configure the Dual-write for Developer (Tier-1) and customer-hosted hosted environment

- Azure Active Directory (AAD) App registration

- Open Azure portal and select Azure Active Directory > App registrations	
- Click on “New registration”
	 
![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1660921073621/Voo2WHHae.png align="left")
Enter the following information:
- Name: Enter a unique name for app
- Account type : Select  supported account types (single or multi-tenant)                                              
- Redirect URI : Keep this field blank   

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1660923139492/KLP3jtc-c.png align="left")
- Copy Application (client) id value in a separate document, you will require this value later

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1660923205838/Vt38-FF-F.png align="left")
- Navigate to newly created Azure application, select Certificates & secrets option                                                        
- Click on New client secret                                            
- Provide description and expiration date                      
- Click on Add                    
- Copy the generated key for later use           

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1660923881355/zKqTlK451.png align="left")
- Copy the generated key for later use

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1660923912176/5pdPmNECi.png align="left")

- Grant app permissions in D365 FO for Dataverse to call D365 FO apps                  
    a.	Navigate to D365 FO System Administration > Users > Users                          
    b.	Create new user as described in the below snap

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1660924577975/XQQSIkmCY.png align="left")                                                                                                              
    c.	Navigate to System Administration Module > Setup > Azure Active Directory applications to register Dataverse

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1660924679085/OsRnsDGmI.png align="left")
# Configure the virtual entity data source
This step will allow Dataverse to connect to D365 FO instance                                        
a. Log in to https://admin.powerplatform.microsoft.com/home        
b.	Navigate to Advanced Settings > Settings > Administration > Virtual Entity Data Sources

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1660924820722/mVKVkKKXP.png align="left")
c. Select the data source “finance and operations”
 
![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1660924883106/NIzf6xxT2.png align="left")
Enter the below information:
1. Target URL – Enter the URL of D365 finance and operations apps.
2. OAuth URL – Enter https://login.windows.net/.
3. Tenant ID – Enter your tenant, such as ABC.com
4. AAD Application ID – Enter the Application ID value that you copied earlier
5. AAD Application Secret – Enter the secret that copied earlier
6. AAD Resource – Enter 00000015-0000-0000-c000-000000000000. (This value is the value for the Azure AD application that represents finance and operations. It is always constant text.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1660924958459/sgpddMCft.png align="left")
- Post-run activities                              
a. Stop and rerun dual-write maps

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1660925027739/hIPKI496g.png align="left")
b. Contact Microsoft's support team to open a support ticket. Enter "Enable 5-minute transaction timeouts for dual-write DV to FinOps transactions" in the title and provide the tenant ID or organization ID. Your session time-out window will be set to five minutes by Microsoft

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1660925072019/ddg6-HpAz.png align="left")
# Sandbox and production environments
Contact Microsoft's support team to open a support ticket. Enter "Enable 5-minute transaction timeouts for dual-write DV to FinOps transactions" in the title and provide the tenant ID or organization ID. Your session time-out window will be set to five minutes by Microsoft.

**Conclusion**

Using the above step-by-step approach, you will be able to increase the default time-out limit from 2 minutes to 5 minutes.

# Thank you for Reading - Let's Connect!
Enjoy my blog? For more such awesome blog articles - follow, subscribe and let's connect on  [LinkedIn](https://www.linkedin.com/in/rakeshdarge/) ,  [Twitter](https://twitter.com/DargeRakesh?s=08) ,[YouTube](https://www.youtube.com/user/rakeshdarge/videos) 

Stay tuned!
