Hi @Carol Lai,
Apologies for the inconvenience caused. We received your feedback that the answer provided on the thread was not helpful.
It's unexpected that your sidecar containers are no longer able to access the environment variables after a few restarts, particularly since you've placed them in the Web App settings as you're supposed to. Under normal circumstances, those settings should apply to all of your containers, including the main one and the sidecars. But sometimes the settings aren't propagated properly.
Double-verify that environment variables are defined at the Web App level (Configuration => Application settings in the Azure Portal) and ensure that the variables are selected as Application Setting and that they are not isolated to a specific container.
Occasionally, restarts or redeployments may cause inconsistent propagation. If the Web App settings panel is not functioning reliably, you can specify environment variables within the container definition in the Deployment Center YAML or through an ARM template. Navigate to Web App => Logs and see if any errors are present when the sidecars attempt to start.
Incomplete environment variables can be associated with startup problems. Rather than stopping and restarting, use the Restart button within the Azure Portal instead. If this persists, you can try triggering a redeployment from the Deployment Center, which tends to reset environment variable propagation.
As you already followed Azure App Service - Sidecar Containers tutorial, if issue continues, refer this: Configure environment variables in Azure App Service.
I have provided a detailed answer which has clear steps for which you are looking for. If you wish, you may re-surveying for the engagement you received on the thread. Your feedback is very important to us.
Looking forward to your reply. Much appreciate your feedback!