One of the most effective ways to extend your SQL Server Integration Services (SSIS) control flow is to use a Script task to write custom code that perform tasks you cannot perform with the built-in components.But it's not straight forward in case of AlwaysOn configured nodes

Below is my current environment setup which helps you to understand the problem.

My environment

  • I am having NODE 1 and NODE 2 as cluster configured
  • SQL Server always on and availability group configured
  • SQL Server file stream is enabled on both node 1 and node 2 entitled as MYSHAREDNAME
  • Internal load balancing Listener configured and entitled as MYACTIVENODE

Problem Statement One of the node among cluster (node 1 or node2) can be down any time. We will not sure which one will become PRIMARY. I am trying to access the shared folder as follow

\NODE1\MYSHAREDNAME - Works if NODE 1 is primary node \NODE2\MYSHAREDNAME - Works if NODE 2 is primary node

But it's difficult to hard code above path as any node can go down. So I used LISTENER name so that it can automatically detect the PRIMARY node to do the desired job as shown below

So I used LISTENER name so that it can automatically detect the PRIMARY node to do the desired job as shown below


But I am not able to access it

How can I fix it? Ports 1433, 5022, 59999 are enabled.

Extract from https://msdn.microsoft.com/en-in/library/dn385720.aspx

AlwaysOn Availability Groups are supported as long as you do not add new database files to the primary database. If a database operation requires a new file to be created in the primary database, first disable AlwaysOn Availability Groups in the secondary node. Then, perform the database operation on the primary database and backup the database in the primary node. Next, restore the database to the secondary node, and enable AlwaysOn Availability Groups in the secondary node. Note that AlwaysOn Failover Cluster Instances is not supported when using the SQL Server Data Files in Windows Azure feature

But I did not understand what does above statement means?

2 Answers 2


I do not believe your extracted quote is relevant to your problem.

Your issue could be that your listener has multiple IP addresses. Under the default configuration, the listener will have multiple A records in DNS and your client will cache only one of them. Each time the cache expires it will randomly grab one of the IP addresses and sometimes it will get the active IP and other times it will get the one that is offline.

This is the purpose behind the MultiSubnetFailover parameter that the listener acknowledges.

  • How can I troubleshoot this?
    – kudlatiger
    Apr 14, 2016 at 10:30
  • You can tell its the problem by running ipconfig /flushdns and testing after each flush. If you see the IP change in a seemingly random pattern then you are experiencing the issue.
    – SQL Hammer
    Apr 20, 2016 at 12:50

After long struggle and network trace capture, I have following data points

  • You can access the File stream shared folder using local machine name.
  • You can access the File stream shared folder using Listener name from local machine which is part of cluster.
  • You can not access the shared folder from any machine which is not part of cluster.
  • You can access SQL server using the listener name but can not access the folder in file explorer from any device which is not part of cluster


We can access file share from other VM which is part of other cloud service

For this to work we need to establish the end point on port 445 (SMB 2.0)

Power shell script

First Get the internal listener name

    Get-AzureInternalLoadBalancer -servicename $servicename

Then, use the internal listener name in below script

       $ServiceName = "ABCCS" # the name of the cloud service that contains the availability group nodes
       $AGNodes = "VM01","VM02" 
       $ILBName = "ListenerLB" //get using Get-AzureInternalLoadBalancer
       ForEach ($node in $AGNodes)
         Get-AzureVM -ServiceName $ServiceName -Name $node | Add-AzureEndpoint -Name "ListenerEndpointFSL" -LBSetName "ListenerEndpointLBFSL" -Protocol tcp -LocalPort 445 -PublicPort 445 -ProbePort 59999 -ProbeProtocol tcp -ProbeIntervalInSeconds 10 -InternalLoadBalancerName $ILBName -DirectServerReturn $true | Update-AzureVM

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.