Kudu authentication 401 error deploying Azure functions using GitHub Actions

Ana Del Campo 121 Reputation points Microsoft Employee
2023-09-30T03:59:49.66+00:00

Trying to deploy an azure function using Github actions or the function deployment tools I keep getting this error,

I have spent hours trying to figure this out to no avail. This is a simple C# HTTP function

Successfully parsed SCM credential from publish-profile format.
Using SCM credential for authentication, GitHub Action will not perform resource validation.
(node:5768) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
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)
Error:       Error: Failed to fetch Kudu App Settings.
Unauthorized (CODE: 401)
    at Kudu.<anonymous> (D:\a\_actions\Azure\functions-action\v1\lib\appservice-rest\Kudu\azure-app-kudu-service.js:69:23)
    at Generator.next (<anonymous>)
    at fulfilled (D:\a\_actions\Azure\functions-action\v1\lib\appservice-rest\Kudu\azure-app-kudu-service.js:5:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
Error: Deployment Failed!


Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,909 questions
0 comments No comments
{count} vote

2 answers

Sort by: Most helpful
  1. MikeUrnun 9,777 Reputation points Moderator
    2023-10-05T05:33:19.0333333+00:00

    Hello @Ana Del Campo - This is likely because the underlying agent VM performing the deployment is not able to access your functions due to networking-related issues. Do you have such networking restrictions in place?


  2. Roosevelt Nelson Jr 0 Reputation points Microsoft Employee
    2024-03-15T13:19:19.6533333+00:00

    The error message indicates that there is a problem fetching Kudu App Settings, resulting in an unauthorized access error (CODE: 401).

    Enable "SCM Basic Auth Publishing Credentials" in general setting or consider a more secure deployment approach using token authentication, such as Microsoft Entra ID authentication.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.