I still got the same error even with Basic Authentication turned On - in my case, it was due to the App Service being disabled for public network access.
I whitelisted my IP under App Service settings in Azure Portal:
Settings -> Networking -> Public network access
My publish worked fine afterwards.