Edi Wang

.NET and Azure Developer

VM

How to Run Windows XP and Windows 2000 VM on Azure in 2024

Microsoft Azure does not officially provide Windows XP images for the creation of virtual machines. The earliest version of a client OS image available on Azure is Windows 7. Despite this, I have devised a method to operate legacy Windows operating systems, including Windows XP, on the current Azure compute platform. In this blog post, I will outline the steps involved in this process in detail. …
Azure VM

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

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

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

How to Restore Connection After Accidentally Disabled NIC on Azure VM

Normally, we uses cloud based VMs through SSH or RDP, so a network connection is necessary for connecting to the VM. But what if you accidentally disabled the NIC on your cloud VM? You may want to call Azure Support or find a previous snapshot for restoring VM. That's not necessary! Azure can help you restore your NIC by yourself in a few steps. Experiment I created a Windows Server 2019 VM on …
Azure VM

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

Setup Experimental Machines with Azure DevTest Lab

Programmers and test engineers always need to set up their own environments for development and testing purposes, and these machines may only be in use for a short period of time. Typically, we use virtual machine products such as Hyper-V and VMWare on the local machine, or we use virtual machines assigned by enterprise IT administrators to do the work. However, installing and managing these VMs …
Azure VM Lab Services

如何定时开关机Microsoft Azure上的虚拟机

作为一个屌丝,用Azure的时候得处处想着省钱,在你不用虚拟机的时候关机是个省钱的好办法。当然,每天手动登录Portal去开关机比较麻烦。如果你用VM的时间段比较固定,可以做个定时开关机的任务帮你省钱。 做法是用一台机器作为Controller,在上面建立开关机任务,调度Azure上的VM。比如你自己的机器每天早上8点开机,下午5点关机。你希望Azure上的某台VM早上8:30开机,下午4:30关机。那你就可以把自己的机器作为Controller。当然,你也可以在Azure上开一台专门作为Controller的Server,给它分配一个768MB内存的屌丝instance(diaostance)来省钱。 这台Controller机器上必须安装Microsoft Azure PowerShell,并且要在PowerShell里登录一次Azure。本文不再叙述,具体做法请看我之前写的《图解 …
Azure PowerShell VM