Updating Azure App Service on Linux for Docker via Webhooks from C#

Georg Dangl by Georg Dangl in Web Development Sunday, May 16, 2021

Sunday, May 16, 2021

Posted in Azure

If you're using Azure App Service to run Docker images, you already know how easy it is to get your app running. Azure nicely abstracts everything for you - it may be a bit more expensive than hosting your own Kubernetes cluster on cloud VMs, but it makes more than up for it in simplicity.

Among the cooler features of using Azure App Service to run Docker ist that you automatically get a green/blue deployment. All you have to do is update the Docker image for the App Service and after a few moments, you're running the latest version, without any downtime. This is super convenient when you're deploying Docker to Azure Container Registry, setting up automatic updates is then just a single click.
However, it's a bit more complicated when you're using something else, e.g. GitHub Packages for hosting your Docker containers, since then you're responsible for calling a webhook in Azure to let it know there's a new container version available.

That's in itself not very complicated, but it has one little point that's worth mentionioning, as you see in the code below:

The webhook url in Azure includes an UserInfo part, meaning it's got username:password right there in the url. Most tools will support that out of the box, but in case you're using .NET to send the webhooks, you should be aware that you need to parse that information and use it with Http Basic Authentication.

By the way, for real life implementations, you probably don't want to hardcode the webhook uri in your build script😀

Happy deploying!


Share this post


comments powered by Disqus

About me

Hi, my name's George! I love coding and blogging about it. I focus on all things around .Net, Web Development and DevOps.

DanglIT

Need a consultant for BIM, GAEB or Software Development?

Contact me at [email protected], +49 (173) 56 45 689 or visit my professional page!

Dangl.Blog();
// Just 💗 Coding

Social Links