Trying to deploy Isolated Azure Func from VS2022 I already created brand new func in Azure portal and scaffolded new function in VS2022 Func works locally. I am deploying using consumption plan and to windows
Getting this when publishing:
Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details.
A diagnostic log has been written to the following location:
"C:\Users\User\AppData\Local\Temp\tmpA19A.tmp"
Nothing helpful in tmpEB87.tmp:
3/8/2024 7:38:58 PM
System.AggregateException: One or more errors occurred. ---> Microsoft.WebTools.Shared.Exceptions.WebToolsException: Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details.
--- End of inner exception stack trace ---
---> (Inner Exception #0) Microsoft.WebTools.Shared.Exceptions.WebToolsException: Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details. <---
Microsoft.WebTools.Shared.Exceptions.WebToolsException: Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details.
===================
Output log:
2>A publish profile with the name 'ZipDeploy' was not found in the project. Set the PublishProfile property to a valid file name.
2>WorkerExtensions -> C:\Users\User\AppData\Local\Temp\farqnhib.ee0\publishout\
2>Publishing C:\Temp\isolated\app\obj\Release\net6.0\PubTmp\isolated - 20240308193855433.zip to https://MYSITE.scm.azurewebsites.net/api/zipdeploy...
2>The attempt to publish the ZIP file through https://MYSITE.scm.azurewebsites.net/api/zipdeploy failed with HTTP status code Forbidden.
ZipDeploy.pubxml file contents:
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<WebPublishMethod>ZipDeploy</WebPublishMethod>
<PublishProvider>AzureWebSite</PublishProvider>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish>https://MYSITE.azurewebsites.net</SiteUrlToLaunchAfterPublish>
<LaunchSiteAfterPublish>false</LaunchSiteAfterPublish>
<ResourceId>/subscriptions/MY_SUBSCRIPTION/resourceGroups/MY_GROUP/providers/Microsoft.Web/sites/MY_SITE</ResourceId>
<UserName>$mysite1</UserName>
<_SavePWD>true</_SavePWD>
<PublishUrl>https://MYSITE.scm.azurewebsites.net/</PublishUrl>
</PropertyGroup>
</Project>
My func project file: isolated.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
<OutputType>Exe</OutputType>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>isolated_test_app</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.21.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.1.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.17.2" />
<PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.22.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.ApplicationInsights" Version="1.2.0" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="local.settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Using Include="System.Threading.ExecutionContext" Alias="ExecutionContext" />
</ItemGroup>
</Project>
I already tried:
- disabling/enabling ftp/scm access in func settings
- updating VS2022 to latest
- checking all logs - on scm also, nothing helpfull
- setting WEBSITE_RUN_FROM_PACKAGE to 0 and then back to 1
- installing/updating azure-cli and azure core tools
- adding publish profile directly from wizard and downloading/adding to VS from Azure Portal
- Check the path to solution, found one advice to remove spaces in path (my path to func: C:\Temp\isolated)
- Renamed publish profile - remove all spaces in name (my name: ZipProfile.pubxml)
- Update all func packages/dependencies to latest version
- Removed WEBSITE_RUN_FROM_PACKAGE in azure portal, reset publish profile, then restarted Func App, then removed profile from VS2022, connected from VS2022 to azure and loaded new publish profile - did not help
- Started VS2022 in administrator mode
My current settings in configuration:

By the way I am able to deploy created zip with command below using azure cli:
az webapp deployment source config-zip --resource-group yourresourcegroupnameonazure --name yourfunctionappnameonazure --src xxx.zip
None-isolated (in-process) function deploys successfully Any suggestions?
Thank you!
HTTP status code 403 Forbidden indicates that the server refuses to authorize the request.
This error may occur if the credentials used to authenticate the request do not have sufficient permissions to perform the operation.
Function App=>Configuration=>General Settings:Once the deployment fails in VS, go to the
Function app=>Functionsin portal, click on Refresh and publish again.Clean and re-build the solution.
Create a new function app via Visual Studio during Publish Profile creation and deploy the function.
I have created a .NET 6 Isolated Azure function and deployed to Azure through Visual Studio.
.csproj:
Application Settings of function App:
zip Deploy.pubxml:
Deployment Status in KUDU site:
References:
Attempt to publish the ZIP file through https://xxx.scm.azurewebsites.net/api/zipdeploy failed with HTTP status code Forbidden.