Edi Wang

.NET and Azure Developer

Azure Function

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

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

Return Excel File in Azure Function

We typically use Azure Function to create APIs or scheduled jobs. For REST APIs that return JSON as response, it's extremely easy, but sometimes, we need another format besides JSON, like a file. Recently I have been working on a project that needs to generate Excel reports from Azure Function. I am using .NET 6.0, C# with Azure Function V4. Let's see how to do it. …
Azure Azure Function

Move CRON Expression from Hard Code to Configuration in Azure Function App

When creating Azure Function with Timer trigger, we usually write CRON expression in our function code. But when you need to dynamically adjust your timer based on business needs, you will have to update your code and redeploy the function. Let's see how we can remove the hard code CRON expression and put it into configuration that we can easily update on the Azure Portal without redeploy the code …
Azure Azure Function

Migrating an ASP.NET Core Web API Project to Azure Function

Some time ago, I successfully migrated an ASP.NET Core Web API project to the latest Azure Function V3, thereby taking advantage of the serverless features of the Azure platform to reduce operation and maintenance costs by 10 times. This article will introduce the key steps and practices in the migration process to help you migrate similar Web API projects. Project background This Web API …
.NET Web API Azure Azure Function

Use Azure Function to Schedule Auto Start for VMs

VMs on the Microsoft Azure platform can be configured to automatically shut down by schedule. However, currently only VMs in the DevTest Lab service can be powered on automatically. Regular VMs have not been updated with the auto start capability. But still, we can take advantage of Azure Function V3 and PowerShell Core to start the VM by timed schedule. The Idea I have wrote a post 6 year ago …
Azure PowerShell VM Azure Function

Create Azure Function App with .NET Core and CD from GitHub

Azure Functions is an event-driven serverless compute platform that can also solve complex orchestration problems. Build and debug locally without additional setup, deploy and operate at scale in the cloud, and integrate services using triggers and bindings. For me, Function can help me quickly develop some simple APIs, and I just need to write business code instead of building fundamental code …
.NET Azure Azure Function GitHub