Edi Wang

.NET and Azure Developer

Microsot Azure The Best Cloud

How to Add Parameters for 'npm install' in Azure DevOps

Recently my Azure DevOps build pipeline failed because Azure is using npm 8.x, which will have issue for angular projects when running `npm install`.  This is a known issue which can be solved by using `--legacy-peer-deps` or `--force` for the `npm install` command. However, Azure DevOps's npm task does not take parameters by default. Let's see how we can use these parameters in Azure DevOps. …
Azure DevOps NPM

Adding Azure Cache for Redis in My Elf Project

ASP.NET Core Memory cache has its own limits. It is difficult to scale in a cloud environment with multiple instances. Azure Cache for Redis provides a fully managed distributed cache service for cloud applications. It is built on top of Redis, a popular cache and messaging product. Integrating Redis into cloud applications can improve performance and scalability. …
Azure Redis

Automated Deployment Script with Azure CLI and PowerShell Core

My blog project, "Moonglade", is optimized for running on Microsoft Azure. It can combine up to 14 Azure services together for a full deployment, manually setup is difficult and takes time. I chose Azure CLI with PowerShell Core to write a deployment script that enables a quick on-board experience to setup Moonglade in 10 minutes with minimal Azure Services. Let's see how it is done. …
SQL Server Azure App Service

How to Get Access Token for Azure REST APIs in .NET

I am recently working on a project that requires front-end to call Azure REST APIs. Microsoft document describes how to get Access Token in postman via Jon Gallant's blog post. However, placing secret keys in front-end is very dangerous. In my project, I must get the Access Token from server side in .NET. Let's see how to do it. …
Azure Azure AD

Log User Identity Information to Azure Application Insights

Azure Application Insights is a very powerful APM tool for monitoring web applications. However, not all features that we sometimes require come out of the box. I now have an ASP.NET Core Web API application that uses JWT authentication. I would like to log user's identity when there is a failed request. Let's see how to do it. …
Azure Application Insight

Upload File with Progress from Browser to Azure Blob Storage

Recently I am working on an internal OA system for a small company. One of their business requirement is for the users to upload attachments when creating a ticket. Azure Blob Storage is ideal for this scenario. However, the attachments are sized from a few KB to hundreds of MB, so it is necessary to show a progress bar when user upload the files. Let's see how can we easily do it with Azure. …
Azure Azure Blob Storage

Identify Users from Different Countries and Regions for Websites on Azure

For websites that need to display different content for users in different countries and regions, we usually identify the user's location based on the IP address. It means we have to write our own code, purchasing and maintaining an IP database, or using a third-party IP data service, it will take huge efforts. How to quickly do it without purchasing an IP database and write a lot of code? …
Azure Front Door