Reputation: 161
I have created an Azure Function in VS 2019 and want to deploy it from VS 2019. While trying to deploy I am getting below error: The attempt to publish the ZIP file through failed with HTTP status code Unauthorized. I have tried following options:
None of the options is working. I am always getting same UNAUTHORIZED error.
Upvotes: 16
Views: 19714
Reputation: 15164
After changing the settings, I had to re-download and re-import the publish profile. Only then did it work.
Upvotes: 0
Reputation: 51
Do the below steps
Upvotes: 2
Reputation: 239
Had this error in IntelliJ rider after authenticating with Azure Toolkit.
Setting basic auth to be on in my App Service configuration section worked.
Upvotes: 0
Reputation: 175
I know this is an old question. However, today I faced this problem and I found out the resolution is this:
there is no need to change Basic Auth Publishing status leave it to On. change FTP state to All allowed.
Upvotes: 10
Reputation: 3687
I was facing the same failure when trying to publish a .NET Azure Function app from Visual Studio and I discovered that the Deploy ZIP file with REST APIs requires basic authentication to be turned on. So, in the Azure Portal for your Azure Function app go to Configuration and then to General Settings and turn on basic authentication.
Upvotes: 27
Reputation: 91
The following setting needs to be set to On. Once it has been, you can publish.
Upvotes: 9
Reputation:
I tried to reproduce your issue. Yes, We will get Unauthorized if the specific key is not passed to the URL after deploying to azure functions.
Every Function app has some authorization levels:
They are defined in authLevel
attribute in function.json code file.
I tried with Admin authLevel to run the function and to get the 401 unauthorized, I given the function key in the function app URL:
Now I have Host (_master) key to the function app URL along with the query string parameter (name), then the result is:
Hence, We get unauthorized when suitable keys are not passed to the function app URL. Based on the authLevel, we have to pass the keys in the URL.
Anonymous - no authentication is required. Any valid HTTP request passes Function - host (master) and function keys. Admin - requires a host key for authorization. System - requires the master key of a function app for authorization. User - requires a valid authentication token.
Function, Admin & System authorization level are key based.
For more information on authorization level usage in function app, refer here.
Upvotes: -1