title: Attempt to publish the ZIP file through https://xxx.scm.azurewebsites.net/api/zipdeploy failed with HTTP status code Forbidden
body: <p>I'm getting this error window message while trying to deploy a .NET 6 <strong>Azure Functions</strong> app to Azure from Visual Studio 2022:</p>
  <blockquote>
  <p>Publish has encountered an error. We
  were unable to determine the cause of the error. Check the output log
  for more details.</p>
  <p>A diagnostic log has been written to the following location:
  &quot;C:\Users\MyUserName\AppData\Local\Temp\tmpEB87.tmp&quot;</p>
  </blockquote>
  <p>The <code>tmpEB87.tmp</code> file contents look like this:</p>
  <pre><code>2/16/2022 1:43:18 PM
  System.AggregateException: One or more errors occurred. ---&gt; 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 ---
  ---&gt; (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. &lt;---
  
  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. 
  
  ===================
  </code></pre>
  <p>The Output log says this:</p>
  <blockquote>
  <p>The attempt to publish the ZIP file through
  <a href="https://xxx.scm.azurewebsites.net/api/zipdeploy" rel="nofollow noreferrer">https://xxx.scm.azurewebsites.net/api/zipdeploy</a> failed with HTTP
  status code Forbidden.</p>
  </blockquote>
  <p>The <code>MyFunctionName - Zip Deploy.pubxml</code> file contents looks like this:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;!--
  https://go.microsoft.com/fwlink/?LinkID=208121. 
  --&gt;
  &lt;Project ToolsVersion=&quot;4.0&quot; xmlns=&quot;http://schemas.microsoft.com/developer/msbuild/2003&quot;&gt;
    &lt;PropertyGroup&gt;
      &lt;WebPublishMethod&gt;ZipDeploy&lt;/WebPublishMethod&gt;
      &lt;PublishProvider&gt;AzureWebSite&lt;/PublishProvider&gt;
      &lt;LastUsedBuildConfiguration&gt;Release&lt;/LastUsedBuildConfiguration&gt;
      &lt;LastUsedPlatform&gt;Any CPU&lt;/LastUsedPlatform&gt;
      &lt;SiteUrlToLaunchAfterPublish&gt;https://xxx.azurewebsites.net&lt;/SiteUrlToLaunchAfterPublish&gt;
      &lt;LaunchSiteAfterPublish&gt;False&lt;/LaunchSiteAfterPublish&gt;
      &lt;ResourceId&gt;/subscriptions/some-random-letters-123456789/resourceGroups/my-resource-group-name/providers/Microsoft.Web/sites/MyFunctionName&lt;/ResourceId&gt;
      &lt;UserName&gt;$MyFunctionName&lt;/UserName&gt;
      &lt;_SavePWD&gt;True&lt;/_SavePWD&gt;
      &lt;IsLinux&gt;true&lt;/IsLinux&gt;
      &lt;PublishUrl&gt;https://xxx.scm.azurewebsites.net/&lt;/PublishUrl&gt;
    &lt;/PropertyGroup&gt;
  &lt;/Project&gt;
  </code></pre>
  <p>I've already spent a ton of time on this, so any help is appreciated.</p>