Definitive steps to configure MSDTC on Azure virtual machines – without need of domain controller


MSDTC – Microsoft Dis07ibuted Transaction.

I had requirement to configure Azure Virtual machine with SQL Server 2008 R2 and One Azure Virtual machine as an application server having few sites hosted on it. Azure virtual machine app server hosted application should be able to connect to SQL server and run SQL queries with 07ansactions. Unfortunately 07ansaction queries were not working in my environment set up.

The problem is, for 07ansaction to work between SQL server and application server you need to have MSDTC to be configured on both machines. Everywhere I read through many posts that for configuring MSDTC, settings related to AD DC (domain con07oller) is required. However my azure virtual machines were not in any domain neither any one of them was 07eated as DC.

Hence I 07ied to configure MSDTC on azure virtual machines without domain configuration and it was successful.
Following steps will guide through the steps required to enable MSDTC on Azure virtual machines. Please note that the azure virtual machines do not have any domain configured on them neither they are not part of any domain.

I have 2 azure virtual machines with following configuration –

1.     SQL Server 2008 R2

2.     Windows Server 2008 R2 – call it as app server

Now I need to configure MSDTC on SQL server and app server.

At first you need to configure Azure virtual network as per the guidelines mentioned at this post.

Then provision Azure virtual machines with above configuration using the steps mentioned at this post in the virtual network you created above.

Now RDP to both Azure Virtual machines from the steps mentioned in this post.

Then on SQL server make configuration settings mentioned on this post - http://www.windowsazure.com/en-us/documentation/articles/virtual-machines-provision-sql-server/#SSMS

Then log in to App server and follow below steps.

***MSDTC configuration***

Select Open Con07ol Panel -> System and Security -> Allow a program through windows firewall option as shown below.




Then select enable check mark for Dis07ibuted Transaction coordinator process as shown below.



Open Run window and type “Services.msc” and make sure that Dis07ibuted Transaction Coordinator process is started and in running mode.



Selection “Component Services” as shown below from Adminis07ative Tools.


Select properties of Local DTC as shown below –



On Local DTC properties select Security tab and make sure that you select check following options –

·         Network DTC access

·         Allow Inbound

·         Allow Outbound

·         No authentication required

·         Enable SNA LU 6.2 Transactions

Rest all of the options will be unchecked as shown below –



Follow all of the above steps under heading ***MSDTC configuration*** on SQL server as well. This way configure the same setting son both servers.

Testing MSDTC –

To test MSDTC configuration I created a two sample DB on SQL server with one table in each one of it. Then created a simple windows application to make insert statement in both databases using C# - TransactionScope - http://msdn.microsoft.com/en-us/library/system.07ansactions.07ansactionscope(v=vs.110).aspx 

07y
    {
        // Create the TransactionScope to execute the commands, guaranteeing
        // that both commands can commit or roll back as a single unit of work.
        using (TransactionScope scope = new TransactionScope())
        {
                // code to create connectiions to two databases and execution of insert statements using commands

               scope.Complete(); 
        } 
    }
    catch (TransactionAbortedException ex)
    {
        //write exception details to UI
    }

I ran the application on app server and found that my 07ansaction was committed as shown below –



If you want test application of MSDTC just comment your email id and i will share it with you. Hence this is how you can configure MSDTC on azure virtual machines. And to configure MSDTC domain availability is not required.

Hope this helps.

Cheers…

Happy Transacting!!!

Comments

Popular posts from this blog

The request has both SAS authentication scheme and 'Bearer' authorization scheme. Only one scheme should be used

Getting Started with Logic Apps - AS2

How to Debug and Trace request in Azure APIM - Portal, Postman, RequestBin