We recently migrated a legacy .NET web service running on-premise to an Azure App Service. During testing we identified an issue with DateTime translations. Our application had a reference to DateTime.Now.
Previously, our app was running on-premise and therefore using Western Australia Standard Time (+8). However, following the migration to Azure, it was using UTC time by default, so we therefore needed to change the default time zone configuration.
In this post I’ll explain how you can update the time zone of your Azure App Service.
Check Baseline Configuration
First, let’s verify the current time zone configuration through the Kudu PowerShell command line.
Open your app service and navigate to Advanced Tools. Open the PowerShell console and execute command Get-Timezone to view the current server time zone configuration.
Update Server Configuration
Now, head into the Azure Portal and navigate to your App Service. Click Application Settings and scroll down to the Application Settings section.
Create a new setting called WEBSITE_TIME_ZONE. Set the value to the name of the time zone you require. A full list of acceptable time zone values are available below
Note: If you check the Slot Setting option, the updated timezone configuration will ‘stick’ to the staging slot when swapped, otherwise it will remain with the active slot.
Now it’s time to verify the change we have made …
Open the Kudu PowerShell console for your App Service and execute command Get-Timezone to view the current server time zone configuration.
It should have changed to the new time zone configuration.
Well that’s it folks. If you have any additional tips, feel free to share them in the comments below.
- Solved: Set SharePoint Person Field to Null in Power Automate - 16th September 2021
- Visual Studio: Generate Class From JSON String - 17th August 2021
- Visual Studio: Show Current File in Solution Explorer - 29th July 2021