Can't publish Function App: "SCM Basic Auth Publishing" keeps resetting to Off

Momo Jeng 5 Reputation points Microsoft Employee
2024-06-21T19:37:25.75+00:00

I am trying to publish an Azure Function from Visual Studio, and keep gettng errors "The attempt to publish the ZIP file through [URL] failed with HTTP status code unauthorized." I also sometimes (but not always) get a warning message saying "Basic auth is disabled for the host [Function App name]"

Other sites indicated that I could fix this by going to the Function App under Settings > Configuration and then the "General settings" tab, and setting "SCH Basic Auth Publishing" to "On." If I do this and hit "Save," I get a popup saying "Successfully updated web app settings." However, attempts to publish still fail.

If I go back to the Function App Configuration page and refresh it typically (but not 100% of the time), I find that the SCM Basic Auth Publishing toggle has switched back to "Off." But even if this hasn't happened right away, if I wait a little bit, I eventually always find that it's gone back to "Off."

What makes this toggle back? Is there any way I can stop this or publish my function anyway?

I have Contributor and Owner roles for the Function App.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,643 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Pinaki Ghatak 3,185 Reputation points Microsoft Employee
    2024-07-01T08:38:26.6133333+00:00

    Hello @Momo Jeng

    This issue could be caused by a few different factors, such as a misconfiguration in your Azure Function App or a problem with your Visual Studio installation.

    However, one possible solution is to try enabling Basic Authentication for your Function App through the Azure Portal. Here are the steps to do so:

    1. Go to the Azure Portal and navigate to your Function App.
    2. Under Settings, select "Authentication / Authorization".
    3. Toggle "App Service Authentication" to On.
    4. Under "Action to take when request is not authenticated", select "Log in with Azure Active Directory".
    5. Save your changes. After enabling Basic Authentication through the Azure Portal, try publishing your Function App again from Visual Studio.