Change timezone for a Linux-based Azure WebApp
The time zone for a Windows-based Azure WebApp can be set using the WEBSITE_TIME_ZONE
app setting. If you try the same with a Linux-based WebApp you may find yourself in trouble.
For a Linux-based WebApp, you must use the app setting TZ
and the correct value can be found in the TZ identifier column in this list.
Or you may use the Kudu interface to run this command:
ls /usr/share/zoneinfo/
...to get a list of regions, including Europe. To list locations in Europe, run:
ls /usr/share/zoneinfo/Europe
...to get Oslo and a lot of other cities. Finally combine them to Europe/Oslo
.
If you did the mistake of adding the WEBSITE_TIME_ZONE
first, the TZ
app setting will not work, and the WEBSITE_TIME_ZONE
can not be deleted from the Azure Portal! (It looks like it can be deleted, but when the page is refreshed the setting is back.)
If you have made the mistake of adding the WEBSITE_TIME_ZONE
app setting to your Linux WebApp, you have two options.
- Delete and recreate the WebApp
- Use Azure CLI
I would recommend option number two. The following command can be used to delete the app setting.
az webapp config appsettings delete
--name MyWebApp
--resource-group MyResourceGroup
--setting-names WEBSITE_TIME_ZONE
That's all!