0

I am trying to setup a PoC for creating Azure Functions in our corporate setup. Creating the function app, and generally using the Azure CLI, works fine.

I have the proxy settings stored in http_proxy and https_proxy.

When using azure-functions-core-tools I receive a "407 Proxy Authentication required" Error on func azure functionapp publish <appname>

Is there a way to

  • Debug the actual error response? (To rule out other reasons than the auth failure)
  • explicitly set the azure-functions-core-tools to use an authenticated proxy e.g. via http_proxy?

I have tried setting --verbose but it does not seem to be supported.

Versions:

  • Azure CLI: 2.0.59
  • azure-functions-core-tools: 3.0.3284
Abaddon666
  • 1,533
  • 15
  • 31
  • You might have better chances in posting your question directly to the github repo https://github.com/Azure/azure-functions-core-tools – silent Mar 01 '21 at 12:56
  • Seems like it is not the #1 priority unfortunately... https://github.com/Azure/azure-functions-core-tools/issues/915 https://github.com/Azure/azure-functions-core-tools/issues/1336 -> Still interested in ideas for a solution – Abaddon666 Mar 01 '21 at 15:15
  • well, the probably best solution is anyway to not deploy from your machine directly (assuming thats what you are trying to do). Use a proper CI/CD pipeline – silent Mar 01 '21 at 15:22
  • @silent of course most environments would be deployed by CI/CD. Still proper dev experience should come with the ability to deploy to Sandbox/Dev environments. – Abaddon666 Mar 01 '21 at 16:38
  • If your corporate network is via VPN then get off the VPN, deploy your stuff, get back on VPN. Given it's a PoC that should be acceptable. All you need are AZ creds that allows you access to your Func App in cloud. – Kashyap Mar 01 '21 at 17:02
  • The goal of the poc is to determine how to get it to work within the network. Turning off the vpn will only result in no internet at all – Abaddon666 Mar 01 '21 at 21:37

1 Answers1

0

I had the same issue, after some research I found this response on github. So, simply add these environment variables either to your system or to your local.settings.json file:

    "http_proxy": "http://mycorporateproxy.com:mycorporateport",
    "https_proxy": "http://mycorporateproxy.com:mycorporateport",
    "no_proxy": "localhost,127.0.0.1",
    "HTTP_PROXY": "http://mycorporateproxy.com:mycorporateport",
    "HTTPS_PROXY": "http://mycorporateproxy.com:mycorporateport",
    "NO_PROXY": "localhost,127.0.0.1"

That approach worked for me.

Vitalii Prodan
  • 175
  • 2
  • 12
  • Unfortunately, this is not working for me. Our proxy is authenticated and it seems to have trouble parsing the proxy connection string with username and password. – Abaddon666 May 24 '21 at 21:12
  • Have you tried to pass username and password to the proxy URL? e.g. `http://:@:` N.B. Make sure you have encoded special characters (`!`,`@`,`-`, etc.) in your password, you can use some online tools for that, e.g. this - https://meyerweb.com/eric/tools/dencoder/ – Vitalii Prodan May 25 '21 at 07:59
  • The azure cli or function core tools seems to misinterpret the @ and use the username/password as host and port if you specify it like this – Abaddon666 May 25 '21 at 11:14
  • Can you show me the example of your URL? Just a pattern, so you can replace any letters and numbers to a fake values – Vitalii Prodan May 25 '21 at 11:55
  • exactly the same pattern you just commented before: `http://:@:` – Abaddon666 May 25 '21 at 12:44
  • I mean username and password, does it include any non alpha-numeric characters? If so, you will need to replace them with URL encoded values, so if you have something like this `http://bob@google.com:strongPas!@mycorporateproxy.com:8080` it should be changed to `http://bob%40google.com:strongPas%21@mycorporateproxy.com:8080` – Vitalii Prodan May 25 '21 at 13:27
  • Ah sorry, misunderstood. I am already using the proxy settings with other tools and it works fine. The problem is not related to encoding issues. Also tried a password without special character, same problem – Abaddon666 May 25 '21 at 17:20
  • Ok, I noticed that it doesn't work for me if I remove `HTTP_PROXY` from my system environment variables – Vitalii Prodan Jun 04 '21 at 15:17
  • @Abaddon666 I would configure CNTLM or PX( https://github.com/genotrance/px) as local proxy server to avoid using passwords in plaintext – Mátyás Kuti-Kreszács Apr 08 '22 at 07:51