Azure login error in GitHub Actions
I recently wrote a tutorial about deploying a MERN stack application to Azure App Service and am currently working on a video version of it too to help those who prefer video.
One of the steps involves forking a GitHub repo with an existing GitHub Actions workflow and then selecting that from the Deployment Center inside Azure App Service. Once updating the default workflow file it generates, it will trigger a new build which often fails. I have done this a few times when testing it out and I often find it fails because of an error relating to Azure login.
"deploy Deployment Failed, Error: No credentials found. Add an Azure login action before this action. For more details refer https://github.com/azure/login".
This always confused me because I knew that the working versions of this don't have any steps relating to Azure login.
But one thing I noticed is that every time a change is deployed to the workflow file, it was running two simultaneous actions. It turned out this was because the forked repo comes with its own workflow file for a previous version of the Azure App Service deployment main_<oldappservicename>.yml. I want the file there as a reference to anyone who looks at the repo without deploying it themselves so don't want to delete it from the original. But in order to make it work with the new workflow without the Azure error in deployment, I had to delete that original file and just keep the one for the new App Service deployment it is linked to. Deleting this original file triggers a new run of the job and you will find that it then works! I hope this helps you unblock yourself in a similar situation. And who knows, maybe it will help future me too!