AzCopy – Unable to connect to the remote server


A lot of customers are working on migrating their workloads to the cloud. If you are building new infrastructure in Azure its common to have the need to upload\download files to and from the Azure. This can be for instance, to upload virtual disks (VHDs) or database backups …etc.

There are many tools that can help you achieve that, the too most common ones are:

  1. Microsoft Azure Storage Explorer (UI tool)
  2. AzCopy (Command-line tool)

If you are looking for a rich and easy to use UI tool you would go with the Microsoft Azure Storage Explorer.

Microsoft Azure Storage Explorer

Microsoft Azure Storage Explorer – v0.8.5

However, if you need to download/upload large files > 500MB its recommended to use the AzCopy command-line.

AzCopy Command-line Tool

AzCopy Command-line Tool

The link above has good documentation about how to use the AzCopy command-line. What I would like to cover here is some troubleshooting tips for using AzCopy. AzCopy command-line tool connects to an Azure storage account either using http or https. That means it communicates through ports 80 or 443. So you need to make sure these ports are open to the internet.

You may have the required ports open but still get a connectivity error, more specifically an error like this ‘Unable to connect to the remote server’. If you are positive that ports are open the next thing to check is, if you need to use a proxy to get to the internet. You can use the switch ‘/v’ to turn on verbose logging. The default location of the log file is at:

‘C:\Users\******\AppData\Local\Microsoft\Azure\AzCopy\AzCopyVerbose.log’. Here is how that connectivity error is logged:

Microsoft.WindowsAzure.Storage.DataMovement.TransferException: Unable to connect to the remote server
 ---> Microsoft.WindowsAzure.Storage.StorageException: Unable to connect to the remote server ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 13.88.145.72:443
   at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
   --- End of inner exception stack trace ---
   at System.Net.HttpWebRequest.GetResponse()
   at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext)
   --- End of inner exception stack trace ---
   at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext)
   at Microsoft.WindowsAzure.Storage.AzCopy.EnumerationHelpers.AzureBlobLocation.<ValidateDestination>b__0()
   at Microsoft.WindowsAzure.Storage.AzCopy.LocationHelper.ValidateAzureDestination(Action existCheck)
   --- End of inner exception stack trace ---
   at Microsoft.WindowsAzure.Storage.AzCopy.AzCopy.ExecuteTransfer(Exception& listFilesException)

If you need to use a proxy you will need to add a config file called ‘AzCopy.exe.config’ to the following location ‘C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy\’. In that file you will need to add the following XML:

<configuration>
   <system.net>
     <defaultProxy>
        <proxy proxyaddress="http://PROXY_ADDRESS:PORT_NUMBER" bypassonlocal="true" />
     </defaultProxy>
   </system.net>
 </configuration>

PROXY_ADDRESS: Is the proxy address used to connect to the internet, e.g. myproxy.company.com

PORT_NUMBER: Is the port number used to connect to the proxy, e.g. 8080

After that the AzCopy command-line tool will run with the configured proxy settings.

Comments (0)

Skip to main content