Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure function publish url is unreachable

My last publish was probably about three weeks ago, today, I changed the code a bit and publish. Then I ran into the error below

Publish has encountered an error. The Publish URL https://functionName.scm.azurewebsites.net/ is unreachable. The application may be stopped, restarting or unavailable. Try again once the publish target is available.

The only similar post I found is suggesting to correct the pubxml field

<PublishUrl>https://waws-prod-<something>.publish.azurewebsites.windows.net/</PublishUrl>

To

<PublishUrl>https://<function-name>.scm.azurewebsites.net/</PublishUrl>

In my case, it is correct already.

If I call the function by HTTP get, it behaves as usual.

I'm relevant new to azure, not sure if I missed something obvious.

Additional remarks

  • It's compiled successfully.
  • I never change the PublishUrl and the field value is pretty much what I posted.
  • The app is running.
  • The account login to VS is the same one to Azure.
like image 750
Circle Hsiao Avatar asked Aug 31 '25 22:08

Circle Hsiao


2 Answers

In my case was related to the SCM Basic Auth Publishing Credentials parameter: it should be On to permit Visual Studio to log-in and publish the function app.

You can find this parameter in your Function App under Configuration -> General settings -> SCM Basic Auth Publishing Credentials

Update 20/06/2024

Today I fell again in the same connection error. In our particular case, the functions we are running are scheduled functions. For security reasons we are disabling all inbound traffic and SCM Basic Auth Publishing Credentials and FTP Basic Auth Publishing Credentials as well.

What I did to fix the today's connection error:

  • Enable 'SCM Basic Auth Publishing Credentials' parameter.
  • Allow inbound traffic to the function. In my case I allowed only our public static IP address.
  • Restart the service.

After function was published I disabled the SCM parameter and disallowed inbound traffic.

like image 167
Guillermo Espert Avatar answered Sep 04 '25 08:09

Guillermo Espert


In my case, I didn't realize I had set up IP restrictions as this was a function app I had published a long time ago so obviously my IP had by this point changed. For me, the solution involved:

  1. Select your Azure Function app in the portal
  2. Under the "Settings" section click "Networking"
  3. Under "Inbound Traffic" I had "Access Restriction" set to "On". If this is your case, click on "Access Restriction". If this is not your case, then this solution won't solve your problem.
  4. My "Unmatched rule action" was set to deny. At the bottom, I had only my old IP and my API Management IPs listed as "Allow.
  5. Click "+Add", enter whatever name that's descriptive (like "My home ip"), make sure action is set to "Allow", set a priority (in my case the priority didn't matter), I skipped description, and for type I chose IPv4 and for IP Address Block I entered my current IP address. Skip the rest of the settings.
  6. At the bottom click "Add rule"
  7. Don't forget to click "Save" at the top left after that
  8. Not sure if you have to restart your function app, I did because it didn't impact me.
  9. I alt-tabbed back to Visual Studio and published again: this time worked perfectly.
like image 29
Architekt Avatar answered Sep 04 '25 07:09

Architekt