In ASP.NET Core there is a great new way to indicate what environment your site is running on. An environment variable has been introduced called ASPNETCORE_ENVIRONMENT. You can find the official documentation here.
Here’s how you set the environment on an Azure App Service. Select the App Service you want to configure, and scroll down to Application Settings.
Under the section App Settings, you can add or update the ASPNETCORE_ENVIRONMENT setting to the correct value. Here it is configured to have Staging as the value.