Edi Wang

.NET and Azure Developer

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

图解:使用Azure PowerShell创建和删除虚拟机

昨天教了大家如何使用Windows Azure PowerShell启动和关闭虚拟机,但光会用PS开关机还是不够的。如果你还在用网页版Portal创建和删除虚拟机,而只用PS去开关机,逼格明显就不完整了。所以今天再教大家如何用Windows Azure PowerShell创建和删除虚拟机,完成整个装逼过程。 首先,使用Windows Azure PowerShell登录Azure账户的步骤不再重复了,上一篇文章里有。假定你已经登录了。 如果你想查看虚拟机列表命令是: Get-AzureVM 1. 要创建虚拟机需要获得一些前置信息。第一个是你的订阅名称。运行这条命令获得: Get-AzureSubscription 在我的例子中,结果是Windows Azure MSDN - Visual Studio Ultimate。这是一个一年价值12w的订阅,大家不要在意这些细 …
Azure PowerShell VM

图解:使用Windows Azure PowerShell启动和关闭虚拟机

我们在使用Azure的时候,如果只会用网页版portal操作是没有逼格的。如果你不在命令行里啪啪啪的敲点东西,就会被Linux狗、Java狗、开源狗鄙视,他们会说用微软产品的人只会用图形界面,微软的程序员只会拖控件。为了挽回我们的逼格,大微软提供了Windows Azure PowerShell,能够让我们以命令行方式操作Azure。今天就教大家如何用Windows Azure PowerShell启动和关闭你的虚拟机。 如果你没安装Windows Azure PowerShell,可以通过大微软的Web Platform Installer安装,本文不再啰嗦怎么安装,反正WPI都是一键搞定的。 启动Windows Azure PowerShell后,第一件事就是要登录你的Azure账户。键入以下命令后会弹出登录界面: Add-AzureAccount 登录完成后, …
Azure PowerShell VM