Primary server 'XYZ' can not write to shared drive during availability group configuration I am in a process of adding databases to availability group. In one of the steps it was asking "data synchronization prefferences" as shown below



I have put the mapped drive location path, which was FILESHARE created in azure portal. 

Now availability group validation fails as shown below, it says "Primary server '[MYNODENAME]' can not write to shared drive during availability group configuration"



Update 

IP for listener was wrong . issue resolved . 

New Error


  The Windows Server Failover Clustering (WSFC) resource control API returned error code 87.  The WSFC service may not be running or may not be accessible in its current state, or the specified arguments are invalid.  For information about this error code, see "System Error Codes" in the Windows Development documentation.
  The attempt to create the network name and IP address for the listener failed. The WSFC service may not be running or may be inaccessible in its current state, or the values provided for the network name and IP address may be incorrect. Check the state of the WSFC cluster and validate the network name and IP address with the network administrator.
  The attempt to create the network name and IP address for the listener failed. The WSFC service may not be running or may be inaccessible in its current state, or the values provided for the network name and IP address may be incorrect. Check the state of the WSFC cluster and validate the network name and IP address with the network administrator. (.Net SqlClient Data Provider)


Here is screenshot
PORT 5022 was not added to secondary node's firewall

After adding rule, it worked like charm

This is how I found the solution

Open command prompt

     Telnet NODE2 5022 


This failed