Setting the Time Zone for Azure App Services: Windows vs. Linux Plans
When deploying applications globally, aligning the application’s time zone with the target business region is essential for accurate logging, scheduling, and reporting. In Azure App Services, the time zone defaults to UTC, which may not align with local business requirements. Setting the correct time zone is straightforward on Windows plans and can be easily applied to Linux plans with a specific configuration. Here’s how to ensure your Azure App Service runs on Australian Eastern Standard Time (AEST) for both Windows and Linux environments.
Problem: Mismatched Time Zones on Azure App Service
For applications deployed in Sydney, Australia, running on UTC can lead to issues with logging, scheduled jobs, and time-sensitive data processing. Mismatches in time zones may affect functionality, especially when the application relies on accurate timestamps. While Windows and Linux-based App Services both support time zone configuration, they each require slightly different settings.
Solution
Setting the Time Zone for Windows App Service Plans
On Windows-based App Service Plans, you can configure the time zone by adding a specific application setting:
- Navigate to the App Service in the Azure Portal.
- Go to Configuration > Application Settings.
- Add a new application setting with the following values:
- Name:
WEBSITE_TIME_ZONE
- Value:
AUS Eastern Standard Time
- Name:
- Save the changes and restart the App Service.
This configuration sets the App Service’s time zone to Australian Eastern Standard Time (AEST) and automatically adjusts for daylight saving time, ensuring accurate local timestamps.
Setting the Time Zone for Linux App Service Plans
On Linux-based App Service Plans, Azure also supports setting the time zone using the WEBSITE_TIME_ZONE
application setting, but with slightly different syntax:
- Go to the App Service in the Azure Portal.
- Navigate to Configuration > Application Settings.
- Add the following application setting:
- Name:
WEBSITE_TIME_ZONE
- Value:
"Australia/Sydney"
- Name:
- Save the configuration and restart the App Service.
With this setting, the Linux App Service will adopt the Australian Eastern Standard Time (AEST) and automatically switch for daylight saving time. Using "Australia/Sydney"
is the key to achieving the correct time zone on Linux plans.
Verifying the Configuration
To confirm the time zone in your application, log the server time in your application’s code or create a test endpoint that displays the system’s current date and time. This check will confirm that the setting has been applied and that the App Service is running on AEST.
Conclusion
Setting the correct time zone in Azure App Services depends on the operating system of the App Service Plan:
- Windows App Service: Use
WEBSITE_TIME_ZONE
with the valueAUS Eastern Standard Time
. - Linux App Service: Use
WEBSITE_TIME_ZONE
with the value"Australia/Sydney"
.
By applying these configurations, you ensure your Azure-hosted application aligns with local Australian time, enhancing accuracy for logs, scheduled tasks, and other time-dependent features.