Changing the timezone on Azure App Services
For my future self: You really can’t fix Azure App Service timezone through web.config. When has web.config ever let you run an application in a different timezone than the host machine?? You dummy.
Azure App Services run in UTC time. This means that for the half of the year, they are conveniently in-time for us brits. But in British Summer Time they’re an hour out. boooo
Now, some people are going to tell you that storing times as UTC and then localising them when they’re read is “best practice” but we don’t listen to them!
We don’t have access to the underlying machine settings on Azure App Services (because it’s shared or ephemeral infrastructure) but you can get Kudu to fix this for you.
The supported way of fixing this is to go into the Azure portal and write an Application Setting with the key WEBSITE_TIME_ZONE
and a value like GMT Standard Time
(here’s the list of supported timezone strings). Shockingly undevopsy. But hey, if you’re a desperately devopsy dev, you can use az cli
or PowerShell to do the same thing! Check out az webapp config appsettings
.
WEBSITE_TIME_ZONE
GMT Standard Time
Every Azure blogger ever has done a post just like this… but I generally search my own blog first to find out what I’ve forgotten. Plus I was in a blog funk so I really needed to post something small like this to prove I can still blog… thank you, readers(?) for obliging me :)