Edi Wang

.NET and Azure Developer

Posts in December 2023

How to Check If Code Is Running on Azure VM

An application needs to know if itself is running in Azure VM, so that it can apply special logic and optimization for Azure. You can check if your code is running on an Azure VM by querying the Azure Instance Metadata Service. This service provides information about running virtual machine instances that can be accessed from within the VM. …
Azure VM

How to Detect If Your Application is Running in Azure App Service

An application needs to know if itself is running in Azure App Service, so that it can apply special logic and optimization for Azure. When deploying an application to Azure App Service, the platform automatically assigns a set of environment variables that can be accessed by the application code. In this post, we will see how can our application get this information. …
.NET Azure App Service