🎄 Merry Christmas! 🎅

Edi Wang

Microsoft MVP for Azure

Posts in 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

Call API with Windows Authentication from Blazor Web Assembly

I was rewriting an old Angular application to Blazor Web Assembly a couple of days ago. The App is an internal tool, which uses a backend API that has Windows Authentication. However, when calling API from HttpClient that UseDefaultCredentials, Blazor will throw PlatformNotSupportedException. The majority of internet search so far tell you it's not possible. Really? Let's see how to make it work! …
.NET Web API Blazor

No Need for a VM, Build Docker Image with Azure Container Registry

Sometimes, there are instances where we need to create a Docker image but do not have access to a Docker environment or prefer not to set up a virtual machine solely for installing Docker. Of course, we can do this with GitHub Actions, but there is an alternative option that I would like to share in this post: utilizing Azure Container Registry to build your Docker image. …
Azure Docker Container

Deploy ChatGPT Next Web to Azure Container Apps with Individual Account Login in 3 minutes

A couple of months ago, I wrote a blog post of "Deploy ChatGPT Next Web to Azure App Service with Individual Account Login in 3 minutes". In this blog post, I will share a new approach to deploy ChatGPT Next Web besides App Service, which is to use Azure Container Apps. My objective is to complete these tasks within three minutes. Let's explore how this can be achieved.
Azure AI Docker Container

How Azure App Service for Linux Runs Your .NET Application

Azure App Service started to support Linux in 2017 as well as containers. It has similar capability as classic App Service on Windows Server, which can run .NET, Java, NodeJs, PHP and Ruby applications with CI/CD and auto scale. In this post, I will use ASP.NET Core application as an example to explore its underlying mechanism to see how it works. …
Azure Linux App Service Docker

Microsoft MVP Testimonial: Transforming Lives in the Elite Tech Community

The Microsoft Most Valuable Professional (MVP) award is a prestigious recognition bestowed by Microsoft to individuals who have made outstanding contributions in the technical community. I am honored to have received this award continuously for the past six years. In this article, I will share my understanding of the MVP award and its impact on both myself and the community.
Microsoft MVP

Solving "npm install" ECONNRESET Error on Azure DevOps

A few months ago, my Angular project on Azure DevOps started to have build failure very often. Error message is "npm ERR! network read ECONNRESET", which indicates npm can't connect to internet. This problem does not happen every time, usually re-run failed jobs several times can produce a good build. But still, this is very annoying. So, I took some time to investigate and solve it. …
Azure DevOps NPM

Deploy Public DNS Server on Microsoft Azure

Deploying a public DNS server on Microsoft Azure can be a crucial step for organizations and individuals that want to provide DNS resolution to the public. Deploying a public DNS server on Azure can provide benefits such as scalability, high availability, and global reach. In this blog post, we will discuss the steps involved in deploying a public DNS server on Microsoft Azure. …
Azure DNS

Deploy ChatGPT Next Web to Azure App Service with Individual Account Login in 3 minutes

ChatGPT Next Web is a well-known web UI project for ChatGPT. However, the official repository does not offer a one-click installation option for Azure, and it lacks individual account authentication. We will explore how to deploy it to Azure without creating a VM, add access control to log in to use ChatGPT without any code modification, and complete these tasks within three minutes.
Azure AI App Service

Setup Hyper-V Server 2019 in My Home PC

I recently bought a HP 800G2 PC for 200 RMB from my company. I decided to use it to host VMs for my tech experiments. Having VMs running in home LAN gives me advantages over remote connection to Azure datacenters, which I would typically use. I ended up installing Hyper-V Server 2019 on the machine and deployed an Ubuntu Server VM and a Windows 10 VM. In this post, I will share the process …
Windows VM Hyper-V

Use Azure Function to Update IP Address in Azure VM NSG Firewall Rule

I have Azure VMs that require being accessed only from 3 IP addresses. Two of these IPs are static, the other is dynamic. Every time the dynamic IP changes, I must manually go to Azure portal and update NSG rules. Because this happens every few days, it makes me work 996. To solve this issue, I created Azure Function to automatically update the NSG rule with a simple HTTP request. …
Azure Azure Function

Fix Azure Linux VM High Memory Usage Because of Microsoft Defender

Recently, my Ubuntu 22.04 VMs are getting unresponsive. From Azure portal, I observe that something quickly eats up all memory on the VM. I'm also difficult to SSH into the VM. After work 996, I finally pinpointed the problem. It is caused by a process named "wdavdaemon", which is Microsoft Dender for Linux. This machine is B1s size and has only 1G memory, MDE is taking 416MB and this …
Azure Linux

How to Run Cloud Init YAML with Azure Bicep when Creating VM

Problem Azure document for "Create an Ubuntu Linux virtual machine using a Bicep file" did not show how to use custom data to run cloud init yaml file when creating VM. After work 996, I finally figured out the undocumented method to run a cloud init yaml file with Azure Bicep. Let's see how to do it. Solution Create a YAML file for cloud init Create a YAML file in the location where your …
Azure VM Linux

Fix Azure Ubuntu Virtual Machine Agent Status is Not Ready Problem

One of my Azure VM running Ubuntu 22.04 LTS suddenly gives a warning message " virtual machine agent status is not ready. Troubleshoot the issue". I recently did some updates and cleaned up the system, it seems the VM agent was destroyed. I've fixed the issue and would like to share the solution. …
Azure VM

Testing Network Speed Between Azure China and Azure Global for B1s VM

Some businesses choose to deploy their systems across both Azure China and Azure Global. For these systems to function effectively, it is crucial that their communication over the internet performs well. To assess the current state of the network between Azure China and Azure Global, I conducted a series of tests and would like to share the results.
Azure VM Network

Cloud Architecture Design of My Email Notification Infrastructure on Azure

My blog system "Moonglade" needs to send email notifications to blog owner when there are events like new comments, new pingbacks, and send email to readers when their comments are replied.  I've been building my own infrastructure in the last few years. I will share the journey of how this email infrastructure evolved and the things I learnt. …
ASP.NET Azure Azure Function Azure Storage Queue

How to Automatically Move Blobs to Cool or Archive Tier After a Period of Time

Azure Storage Account offers three tiers of blob storage. Hot, cool and archive. We usually use hot tier for data that needs to be accessed frequently, move blobs to cool tier if they won't be used very often, and archive blobs when they are not used at all. However, manually, or programmatically moving blobs still require an amount of work to do. Let's see how to do it without any programming. …
Azure Azure Blob Storage

How to Activate Kendo UI License in Azure Static Web Apps Without Exposing Secret Value

I have an open-source project that uses Kendo UI for Angular. In order for users to have BYOL model, I could not include the license file in my public repository. There is no example of how to activate Kendo license during SWA build process. Let's see how to activate Kendo UI license during the build process of Azure Static Web Apps without including the license itself in repository. …
Azure Kendo UI GitHub