Update your Azure WebApp to use your timezone
By default, the timezone in Microsoft Azure defaults to UTC (Universal Coordinated Time) as a standard, as a universal and consistent timezone, this makes sense - however when troubleshooting issues or attempting to schedule jobs, having the time in UTC may add additional confusion. An Azure WebApp is no exception to UTC as a standard, however, this can be changed.
As I am in 'New Zealand', I will be setting my WebApp (which is hosted in Australia East) to NZ time from UTC.
I will be using a Windows-based App Service, for this article.
Find the Timezone
The Azure App Service uses the same naming standard as Windows.
-
To find the correct name, run the following PowerShell snippet on a Windows PC:
Get-ChildItem -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones' | Select-Object PSChildName
This will list all the compatible Timezone names, because I am in New Zealand, I now know that: 'New Zealand Standard Time' is the correct syntax.
For future reference, I have exported the list of compatible timezones into a CSV file below:
Set the Timezone
Making a change to the Application Settings, which includes setting the Timezone will restart the WebApp app pool, so make sure this is scheduled at a time it is acceptable for an intermittent outage.
- Log in to the Azure Portal
- Find your Azure WebApp and open it up
- On the left-hand side Blade, underneath Settings, click on Configuration
- Click on + New Application Setting
- Type in the following Key/Value pair: WEBSITE_TIME_ZONE | New Zealand Standard Time
- Click Ok
- Click Save to confirm and save the change.
Test the Timezone
- Log in to the Azure Portal
- Find your Azure WebApp and open it up
- On the left-hand side Blade, underneath Development Tools, click on Console
- Type the following into the console:
- Time
- Date
These commands can help you confirm, that the Date and Time now your Timezone, the Azure WebApp logs etc will now be updated to use your timezone.