AzCopy – behind proxy
There are some days in your life when you feel you would like to do something different in Azure than other days such as you want to create and upload your own VHD to Azure (instead of using VM images from marketplace). It seems this is a very hard challenge because you need a local virtualization environment (VMWare, Hyper-V, etc), you have to prepare your custom VM for Azure somehow, etc. But finally you are happy because you merely have to upload the VHD file to Azure and you can use your customized VM there.
After some hours you started these activity and you are very suprised because everything seems good and fine. Therefore you are looking for the copy-to-Azure step because that is only a copy with AzCopy – this is easy. 🙂 You open AzCopy command window, make the copy command with paths and keys and patterns and paste it to the command window. – Maybe when your finger are closer and closer to Enter button you are thinking about you will have now 30-50 minutes free time (till the VHD will be uploaded). – And you are facing the cruel reality, that you get an error:
[ERROR] Microsoft.WindowsAzure.Storage.StorageException: The remote server returned an error: (407) Proxy Authentication Required.
Here you try to use the Git and Visual Studio Code related configuration tricks but you cannot find the related configuration file. Then read hundreds of articles on the Internet where you can find hundreds of trying for .NET framework config modification which do not work.
And finally after 120 articles you find a line about AzCopy.exe.config which originally does not exist but if you create it you will be able to put there proxy related configuration.
So I created it to “C:\Program Files\Microsoft SDKs\Azure\AzCopy” and put some lines there like
<proxy proxyaddress="http://<proxy server>:<port>" bypassonlocal="true" />
Of course it does not work. Then I put other lines regarding the other hundred articles I read before and it work from now. 🙂
<configuration> <system.net> <defaultProxy enabled="true" useDefaultCredentials="true"> <proxy proxyaddress="http://<proxy server>:<port>" bypassonlocal="true" /> </defaultProxy> </system.net> </configuration>
Please test it behind your proxy and send me feedback about it.