I need to change the date / time of my Azure App Service. This will help me in time travelling the API to a past date. I have used linux based image of .Net Core API, deployed as container in Azure App Service. In this API I have a method which currently returns the system date and time.
I know there is a way to set the timezone. This can be part of the dockerfile. I am trying to look for a similar way to change the date.
There are multiple ways to get the current time. You can set the right time zone then get the system current time.
You can follow the ways to set the time zone in the docker container or Dockerfile here. Also, you can set the time zone in Azure Web App while you deploy your application in it. Azure Web App uses the environment variable WEBSITE_TIME_ZONE
to set the time zone. For more details, see AppService: Setting a time-zone with a WEBSITE_TIME_ZONE App Setting (and many more).
But I would suggest you just get the current UTC time and then calculate your time with the right time zone in your code. This is the best way to get the time as I think.
Update
As I think, what you need is to configure the SSH server in the custom image and then when you deploy the image to Azure Web App, you can ssh into the container to debug. So, you could follow the steps in SSH support for Azure App Service on Linux to configure the SSH server.
You can also set the date when you create the image from Dockerfile. Here is an example.