0

I am trying to publish a C# Function App to a Linux machine in Azure using VS2022. The same function App can be published to a Windows machine without any problems.

I have followed the advice of the people answering the question below: Publish Function App to azure zipdeploy failed with HTTP status code Unauthorized and I have tried this fix: https://github.com/Azure/azure-functions-dotnet-worker/issues/2502

  • Basic Authentication was turned on while deploying the function app.
    turned on
  • Run from package is turned on
    run from package
  • I created a fresh publish profile after checking these settings.
  • Disabeled Access-Control-Allow-Credentials
  • Removed any allowed Origins
    enter image description here

I do get this notification whan trying to publish:

enter image description here

I think this doesnt have anything to do with the authorization for publishing.

I am not sure what to try next.

1
  • Can you try deploying using command func azure functionapp publish <functionappname>. Also SCM basic auth setting should be turned on during deployment. It turns off automatically sometimes. Commented Sep 12, 2024 at 15:07

1 Answer 1

0

Though you have enabled the SCM basic auth setting, it turns off automatically sometimes during deployment.

To avoid unauthorized error during deployment, turn off and turn on the SCM basic auth Publishing credentials setting in Function app=>configuration and refresh the function app before performing deployment.

You can also enable this setting during function app creation by enabling Basic authentication under Deployment section to avoid deployment errors:

enter image description here

enter image description here

Add SCM_BUILD_DURING_DEPLOYMENT=1 and ENABLE_ORYX_BUILD=true application settings in the function app's Environment variables=> App Settings:

enter image description here

Configure Functions_Worker_Runtime setting according to your function's runtime.

Delete the C:\Users\uname\AppData\Local\AzureFunctionsTools folder, reopen the visual studio IDE and deploy the function again.

I have created an isolated function and deployed to Linux Azure function app.

.csproj:

  <ItemGroup>
    <FrameworkReference Include="Microsoft.AspNetCore.App" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.22.0" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.1.0" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="1.2.1" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.17.4" />
    <PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.22.0" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker.ApplicationInsights" Version="1.2.0" />
  </ItemGroup>
  • Deployed using Visual studio:

enter image description here

As an alternative, try deploying the function using function core tools:

func azure functionapp publish <functionappname>

Portal:

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.