Austin Howard
Austin Howard

Reputation: 1144

unable to deploy to azure web app services

I am experiencing a weird error when trying to build a continous pipeline build from github to azure app services. Ive done deploys before from other accounts and they work just fine, the difference between those accounts and this one is its a personal account and its on a free-tier. the others are not. but still i am receiving an unathorized error

Run azure/webapps-deploy@v2
  with:
    app-name: contactKeeper
    slot-name: Production
    publish-profile: ***
    package: .
Package deployment using ZIP Deploy initiated.
Error: Failed to deploy web package to App Service.
Error: Deployment Failed with Error: Error: Failed to deploy web package to App Service.
Unauthorized (CODE: 401)
App Service Application URL: http://contactkeeper.azurewebsites.net

Does anyone know why i am receiving this issue?

Upvotes: 6

Views: 17245

Answers (4)

shalitha senanayaka
shalitha senanayaka

Reputation: 2548

If you encounter this issue, please verify your Basic Authentication Settings. Follow the instructions below:

  1. Navigate to the Deployment Center and inspect for any red flag messages as shown below,

Warning Message

  1. Click the Red flag notification and it will navigate you to the Configuration section. Then click the General Settings Tab.

  2. In the Platform settings, ensure that both Basic Auth Publishing Credentials and FTP state configurations match as indicated below.

Platform Settings

  1. Save the configuration and try to re-run the flow.

Upvotes: 4

Konstantin Grigorov
Konstantin Grigorov

Reputation: 1642

This is one of the two Azure & Kudu 401 threads in SO and it didn't help me much, so here are my 2 cents.

My setup:
I am using Azure Function Apps in combination with GitHub Actions.

Stack trace:

Successfully parsed SCM credential from publish-profile format.
Using SCM credential for authentication, GitHub Action will not perform resource validation.
Error: Execution Exception (state: ValidateAzureResource) (step: Invocation)
Error:   When request Azure resource at ValidateAzureResource, Get Function App Settings : Failed to acquire app settings from https://<scmsite>/api/settings with publish-profile
Error:     Failed to fetch Kudu App Settings.
Unauthorized (CODE: 401)

Interpretation:
Your credentials have been retrieved and processed but they are wrong.

Solution:
Copy the publish profile from the Azure Function App dashboard. enter image description here

Paste it in the associated GitHub Actions Secret. enter image description here Those two should match.

Upvotes: 7

Austin Howard
Austin Howard

Reputation: 1144

The only thing I can think of is the reason for this issue, was, i was hitting some kind of wall with the amount of app resources i was using, i used a paid subscription tier in a different account and was able to successfully deploy the app to that location. the app still returns this error if i try to deploy it to the free tiered account.

the answer: Upgrade from a base free tier to a pay tiered.

Upvotes: 1

AjayKumarGhose
AjayKumarGhose

Reputation: 4923

Thank you vincent1173 posting your suggestion as an answer to help other community members.

Error: Deployment Failed with Error: Error: Failed to deploy web package to App Service. Unauthorized (CODE: 401)

For this error , you can try to set an application setting WEBSITE_WEBDEPLOY_USE_SCM and value true in Azure Portal and retry the deployment after 1 min.

Here is the step : Go to Azure portal>App service> Configuration> Add application setting and save it.

enter image description here

For more information please refer this Microsoft Documentation : Deploy an Azure Web App

Upvotes: 5

Related Questions