The “Publishing failed” error message will make you feel cursed. It appears when publishing an Azure serverless Function directly from Visual Studio 2017. Some never see it, but those who do can’t seem to get rid of it.
I tried all the recommended internet forum voodoo of creating new deployment profiles, restarting Visual Studio, cleaning the project and downloading deployment profiles. If it did go away for once, it always came back.
What finally worked for me was upgrading Visual Studio 2017 to the latest version (as of now v15.9.21) and switching from Web Deploy to Zip Deploy. This is done by checking the new “run from package file” option.
Zip Deploy has other benefits as well, such as shorter cold starts for large deployments and ability to replace a running function in production without downtime.
You can see the deployment profile type by expanding the PublishProfiles folder.