AZCopy - The server returned an error: (407) Proxy Authentication Required.

AzCopy is a great little tool for copying and manipulating azure storage. You can find more information about it here

Behind a proxy in a corporate firewall, I get this error.

1The server returned an error: (407) Proxy Authentication Required 

Usually I add the following to my powershell command before running them

1[System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
2Azcopy 

But that gave me the error:

1[ERROR] Error parsing destination location : The remote server returned an error: (407) Proxy Authentication Required.

Create config file for AZCopy

I couldn’t find a config file for azcopy. So I created the config file in the location of azcopy C:\Program Files (x86)\Microsoft SDKs\azure\azcopy

Step 1. Create AzCopy.exe.config file

1New-Item C:\Program Files (x86)\Microsoft SDKs\azure\azcopy\AzCopy.exe.config -type file

Step 2. Add the following into the config file:

1<configuration>
2   <system.net>
3     <defaultProxy enabled="true" useDefaultCredentials="true">
4     </defaultProxy>
5   </system.net>
6 </configuration>

Magic! :-)