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.

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

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

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

But that gave me the error:

[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

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

Step 2. Add the following into the config file:

<configuration>
   <system.net>
     <defaultProxy enabled="true" useDefaultCredentials="true">
     </defaultProxy>
   </system.net>
 </configuration>

Magic! :-)