Tag: VM

Windows 10 development virtual machine VM

Create a Windows 10 development virtual machine

If you want to create a Windows 10 development virtual machine (VM) on your Windows 10 device, Microsoft Hyper-V with the quick start gallery has you covered. So in this blog, we are going to have a look at how you can create a Windows 10 development virtual machine VM) on Windows 10. These are some easy and simple steps to automatically download and create your Windows 10 dev VM.

Microsoft offers a Windows 10 development VM which includes a preinstalled version of Windows 10 with Windows 10 SDK, Visual Studio 2019 (with the UWP, .NET desktop, and Azure workflows enabled and also includes the Windows Template Studio extension), Visual Studio Code, the Windows Subsystem for Linux, Developer mode enabled, and much more.

If you are running Windows 10 on you laptop, you can easily do all of this using Hyper-V and build-in tools. If you want to run this development virtual machine on different virtualization software options like VMware, VirtualBox, and Parallels, check out my links below.

If you want to learn more about how Hyper-V can empower developers, check out my blog post Hyper-V for Developers.

Create a Windows 10 development virtual machine using Hyper-V

To get started you will need to enable Hyper-V on your Windows 10 machine. The Hyper-V feature has a couple of prerequisites:

  • Windows 10 Enterprise, Pro, or Education
  • 64-bit Processor with Second Level Address Translation (SLAT).
  • CPU support for VM Monitor Mode Extension (VT-c on Intel CPUs).
  • Minimum of 4 GB memory.

The Hyper-V role cannot be installed on Windows 10 Home. Upgrade from Windows 10 Home edition to Windows 10 Pro by opening up Settings > Update and Security > Activation.

For more information and troubleshooting, see Windows 10 Hyper-V System Requirements.

To enabled Hyper-V on Windows 10 open up PowerShell as Administrator and run the following command:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All

After that your computer will ask you to reboot.

Now you can open the Hyper-V Manager from the startmenu and on the right you can click on “Quick Create…“.

Create a Windows 10 development virtual machine
Create a Windows 10 development virtual machine

Here you can find a couple of free images you can use like Ubuntu Hyper-V Images and more. It also includes the Windows 10 dev environment VM. Select the Windows 10 dev VM and click on Create Virtual Machine. This will download the image and create the virtual machine.

Download Windows 10 dev environment VM
Download Windows 10 dev environment VM

After the VM is successfully created, you can start the VM by clicking Connect, or first edit the settings.

Virtual machine created successfully
Virtual machine created successfully

Since Windows 10 is running inside a virtual machine, by default you will be using the Windows Subsystem for Linux version 1. If you want to use the WSL 2 (Windows Subsystem for Linux 2) inside the Windows 10 dev virtual machine, you will need to enable nested virtualization on your Hyper-V machine.

Run this command as Administrator in PowerShell on the Windows 10 machine (not inside the virtual machine).

Set-VMProcessor -VMName "Windows 10 dev environment" -ExposeVirtualizationExtensions $true
Set-VMNetworkAdapter -VMName "Windows 10 dev environment" -MacAddressSpoofing On

You will need to run these commands while the virtual machine is still turned off.

Now you can start using your Windows 10 development virtual machine. With enhanced session mode on, you can also easily copy-paste files between the Windows 10 host and the VM.

Windows 10 development virtual machine VM
Windows 10 development virtual machine VM

Create a Windows 10 development virtual machine on VMware, VirtualBox, or Parallels

If you want to run your Windows 10 dev VM on VMware, VirtualBox, or Parallels, you can download images on the following website.

Conclusion

I hope this blog post was helpful. If you have any questions, feel free to leave a comment below. If you want to learn more about how Hyper-V can empower developers, check out my blog post Hyper-V for Developers.



How to run PowerShell scripts against multiple Azure VMs in parallel by using Run Command

How to run scripts against multiple Azure VMs by using Run Command

I wrote a blog post on how to run scripts in your Azure VM by using Run Command, and explained how handy this feature is to manage Azure virtual machines (VMs). In this blog post, we are going to have a look at how you can run scripts against multiple Azure virtual machines (VMs) by using PowerShell and the Invoke-AzVMRunCommand feature.

Usually, you can access your Azure virtual machine (VM) in multiple ways, like SSH or RDP. However, if you have issues with the RDP or SSH network configuration, or don’t have any network access at all, the Run Command feature is another option. Run Command can run a PowerShell or shell script within an Azure VM remotely by using the Azure Virtual Machine Agent. This scenario is especially useful when you need to run scripts against Azure VMs where you do not have network access.

You use Run Command for Azure VMs through the Azure portalREST APIAzure CLI, or PowerShell. Like I showed you in my blog post on Microsoft Tech Community.

Azure VM Run Command in the Azure Portal
Azure VM Run Command in the Azure Portal

Using Azure PowerShell

You can also use Azure PowerShell to use the run command capabilities to run PowerShell scripts against the guest agent inside the Azure VM. For that, you can simply use the Invoke-AzVMRunCommand cmdlet from the Az PowerShell module. You can also run this command directly from Azure Cloud Shell as well.

How to run PowerShell scripts against multiple Azure VMs by using Run Command in Parallel

Now here is how you can use PowerShell 7 and the Azure PowerShell module, to run scripts against multiple Azure VMs in parallel. For that, I am using a simple Foreach-Object to run the script in “script.ps1” against all my Azure VMs in a specific resource group. By default, this would take some time because it would run through all the virtual machines in sequential order. However, with PowerShell 7 we can use the -Parallel parameter to run the commands in parallel.

#Azure Subscription I want to use
$subscriptionId = "XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
#Resource Group my VMs are in
$resourceGroup = "test-azurevms-rg"

#Select the right Azure subscription
Set-AzContext -Subscription $subscriptionId

#Get all Azure VMs which are in running state and are running Windows
$myAzureVMs = Get-AzVM -ResourceGroupName $resourceGroup -status | Where-Object {$_.PowerState -eq "VM running" -and $_.StorageProfile.OSDisk.OSType -eq "Windows"}

#Run the scirpt again all VMs in parallel
$myAzureVMs | ForEach-Object -Parallel {
    $out = Invoke-AzVMRunCommand `
        -ResourceGroupName $_.ResourceGroupName `
        -Name $_.Name  `
        -CommandId 'RunPowerShellScript' `
        -ScriptPath .\script.ps1 
    #Formating the Output with the VM name
    $output = $_.Name + " " + $out.Value[0].Message
    $output   
}
How to run PowerShell scripts against multiple Azure VMs in parallel by using Run Command
How to run PowerShell scripts against multiple Azure VMs in parallel by using Run Command

I also modified the output, so it shows the VM name I have run the script against, and I selected only the Message output of Invoke-AzVMRunCommand.

You can also check out my video on YouTube:

Conclusion

I hope this blog post helps you to run PowerShell scripts against multiple Azure virtual machines (VM) in parallel using the VM run command. If you have any questions feel free to leave a comment.



Azure geography and Azure Regions

How to check the available VM Sizes (SKUs) by Azure Region

Do you want to know which Azure VM (virtual machine) sizes are available in an Azure region? Here are some simple ways like the Azure product page, the Azure portal, the Azure CLI, or a simple Azure PowerShell command to list the Azure VM sizes per Azure region. As you know Microsoft Azure has different Azure Regions available around the world. While the teams are working hard to make services available in these regions, it can happen that certain Azure services and virtual machine sizes (SKUs) are not available in some of the regions.

Azure geography and Azure Regions
Azure geography and Azure Regions

If you want to know more about Azure Regions, check out our Azure geographies.

Available VM Sizes (SKUs) by Azure Region Product Page

Now to check which services are available in your preferred Azure region, I recommend that you check out the Products available by region page on Azure.com. If you search for virtual machines, you will find a list of Azure VM sizes available per region.

Products and services available by Azure region

Azure Portal

When you deploy an Azure VM directly from the portal, you can see the available Azure VM SKUs for the region you have selected.

VM sizes in the Azure portal
VM sizes in the Azure portal

Available VM Sizes (SKUs) by Azure Region CLI and PowerShell

Now if you are using the command line while working with Azure, might don’t want to always open a web browser, you can simply use the Azure CLI or Azure PowerShell.

Azure CLI

With the Azure CLI you can run the following command. If you haven’t set the default output format to table in your Azure CLI, you can use the -o “table” parameter.

az vm list-sizes --location "eastus"
Azure CLI list VM sizes
Azure CLI list VM sizes

Azure PowerShell

With Azure PowerShell, you can use the following command

Get-AZVMSize -Location "eastus"
Azure PowerShell Get-AzVMSize
Azure PowerShell Get-AzVMSize

You can also us PowerShell to simply filter for different sizes, suing the Where-Object.

Get-AzVMSize -Location "eastus" | Where {$_.NumberOfCores -gt 128}
VMs with more than 128 cores
VMs with more than 128 cores

Conclusion

I hope this short guide helps you to easily list the find the available Azure VM sizes per region. If you have any questions, feel free to leave a comment.



Microsoft Learn Windows Server Hyper-V and Virtualization

Learn about Windows Server Hyper-V and Virtualization

As you know, my background is doing a lot of datacenter and virtualization projects using Hyper-V and System Center. I often get asked, how do I start learning about Windows Server Hyper-V, and virtualization, including Windows Server Containers. So if you are a Windows Server Hyper-V admin or want to learn about virtualization, we have a new Microsoft Learn learning path ready. In the new Windows Server Hyper-V and Virtualization learning path you will be able to learn to implement and manage Windows Server virtual machines (VMs) and container workloads using Windows Server Hyper-V.

Windows Server Hyper-V and Virtualization Microsoft Learn Modules

Currently, the learning path consists of 6 modules:

Configure and manage Hyper-V
Learn about virtualization and the Microsoft Hyper-V role with Windows Server. Learn about best practices for preparing Hyper-V hosts, in addition to Hyper-V networking features and implementing nested virtualization.

Configure and manage Hyper-V virtual machines
Learn about configuring and managing Hyper-V virtual machines in Windows Server 2019.

Secure Hyper-V workloads
Learn about securing Hyper-V workloads in Windows Server 2019, installing and configuring the Host Guardian Service (HGS), the attestation modes available with the HGS, and the creation and deployment of shielded virtual machines (VMs).

Run containers on Windows Server
Learn about Windows Server and Hyper-V containers, associated isolation modes, running containers, and preparing the Windows Server host for running containerized workloads. Learn about Docker, preparing Windows Server for running container workloads, and managing containers.

Orchestrate containers on Windows Server using Kubernetes
Learn about Kubernetes, containers, container orchestration, and Kubernetes orchestration in Windows Server 2019. Also learn the process for deploying a Kubernetes cluster on Windows and describe how to use Azure Arc for Kubernetes.

Implement Hyper-V Replica
Learn about Hyper-V Replica, scenarios for its use, and prerequisites to use it. Learn about Azure Site Recovery and the benefits of using it, focusing on implementing Site Recovery in on-premises scenarios.

Conclusion

I hope these links are useful to you and it helps you to learn more. If you have any questions feel free to leave a comment, and for more Hyper-V content, check out my blog.



How to monitor an Azure virtual machine with Azure Monitor

How to Monitor an Azure virtual machine with Azure Monitor

This week in the Azure tip video, we are going to have a look at how to monitor an Azure virtual machine (VM) with Azure Monitor. You can use Azure Monitor to collect and analyze monitoring data from Azure virtual machines to maintain their health. Virtual machines can be monitored for availability and performance with Azure Monitor like any other Azure resource, but they’re unique from other resources since you also need to monitor the guest operating and system and the workloads that run in it.

To learn more about how to monitor Azure virtual machines (VMs) with Azure Monitor, you can check out the following links:

  • Microsoft Docs: Monitoring Azure virtual machines with Azure Monitor
  • Quickstart: Monitor an Azure virtual machine with Azure Monitor

You can also check out how you can connect Windows Server machines in hybrid environments to Azure Monitor using Windows Admin Center here. If you have any questions, comments, or another great idea for an Azure tip video, feel free to leave a comment below.



Manage updates and patches for your Azure VMs

Manage updates and patches for your Azure VMs

In this week’s Azure tip video we are going to have a look at how to manage updates and patches for your Azure virtual machines (VMs). After watching this video, you’ll be able to enable Azure Update Management, deploy updates, review an update assessment, and manage updates for your Azure VMs.

You can use Update Management in Azure Automation to manage operating system updates for your Windows and Linux machines in Azure, in on-premises environments, and in other cloud environments. You can quickly assess the status of available updates on all agent machines and manage the process of installing required updates for servers. If you want to learn more, check out my blog post on how to manage updates on Azure VMs. Also, make sure you check out a new feature called Azure Automatic VM Guest OS patching. To learn more about that feature, check out my blog post: How to configure Azure Automatic VM guest OS patching

To learn more about Azure Update management for your Azure virtual machines, check out the following links:

I hope this video was help full when it comes to managing updates and patches for your Azure VMs. If you have any questions, comments, or another great idea for an Azure tip video, feel free to leave a comment below.



Azure VM Run Command Run PowerShell Script

How to Run Scripts in your Azure VM using Run Command

You can access your Azure IaaS virtual machine (VM) in multiple ways like SSH or RDP, depending on your operating system and configuration. However, if you have issues with the RDP or SSH network configuration, you need to have a way to troubleshoot your virtual machine (VM). Luckily Azure offers you different management tools to work with Azure VMs for automation or troubleshooting. With the Run Command can run a PowerShell or shell script within an Azure VM remotely by using the VM agent. This scenario is especially useful when you need to troubleshoot operating system network configurations or user access configuration. For example, it can be convenient to reset RDP configurations on Windows Server virtual machines.

You use Run Command for Azure VMs through the Azure portal, REST API, Azure CLI, or PowerShell. Here are some examples:

Azure VM Run Command in the Azure Portal

You can run the command directly from the Azure Portal. In the menu of the Azure VM, you can select Run command. Here you can find some predefined scripts to troubleshoot your Azure VM. In the case of a Windows VM, you will find scripts like configuring RDP port or enable PowerShell remoting. But you can also run your custom PowerShell script.

Azure VM Run Command Run PowerShell Script

Azure VM Run Command Run PowerShell Script

For Linux VMs, you will find predefined options to run a Linux shell script or ifconfig to list the network configuration.



Automanage for Azure virtual machines

Automanage for Azure virtual machines

For me, one of the most impressive announcements at Microsoft Ignite, next to many of the Azure Arc and Azure Stack announcements, was the announcement of the Azure Automanage for virtual machines (VMs) public preview. As you know, Microsoft Azure offers many management services for Azure virtual machines (VMs). However, finding and configured these services can be some work. Azure Automanage for virtual machines helps to address precisely that. Azure Automanage for virtual machines is a service that eliminates the need to discover, know how to onboard, and how to configure certain services in Azure that would benefit your virtual machine.

UPDATE: Azure Automanage now also supports servers running outside of Azure (on-premises or other cloud providers) using Azure Arc. Check out my blog for more details: Azure Automanage for Arc enabled servers

In summary, Azure Automanage provides the following features to reduced cost by automating Windows Server management, improved workload uptime with optimized operations, and implementation of security best practices.

  • Intelligently onboards virtual machines to select best practices Azure services
  • Automatically configures each service per Azure best practices.
  • Monitors for drift and corrects for it when detected.
  • Provides a simple experience (point, click, set, forget)

You can find more information on Microsoft Docs.



Azure Automatic VM Guest OS Patching

How to configure Azure Automatic VM guest OS patching

If you want to keep your Azure virtual machines (VMs) up-to-date, then there is a service called Azure Update Management, which helps you to manage updates on your Azure VM guest operating system. However, this needed some additional planning and configuration. To make patching of your Azure virtual machines (VMs) easier, there is a new option called Automatic VM guest patching, which helps ease update management by safely and automatically patching virtual machines to maintain security compliance.

Automatic VM guest patching is now available in public preview for Windows virtual machines on Azure.

With Azure automatic VM guest patching enabled, the VM is assessed periodically to check for available operating system patches for that Azure VM. Updates classified as ‘Critical’ or ‘Security’ are automatically downloaded and installed on the VM during off-peak hours. This patch orchestration is managed and handled by Azure and patches are applied following availability-first principles.

In a nutshell, Azure automatic VM guest patching has the following capabilities:

  • Patches classified as Critical or Security are automatically downloaded and applied on the VM.
  • Patches are applied during off-peak hours in the VM’s time zone.
  • Patch orchestration is managed by Azure and patches are applied following availability-first principles.
  • Virtual machine health, as determined through platform health signals, is monitored to detect patching failures.
  • Works for all VM sizes.

Patches are installed within 30 days of the monthly Windows Update release, following availability-first orchestration described below. Patches are installed only during off-peak hours for the VM, depending on the time zone of the VM. The VM must be running during the off-peak hours for patches to be automatically installed. If a VM is powered off during a periodic assessment, the VM will be automatically assessed and applicable patches will be installed automatically during the next periodic assessment when the VM is powered on.

You can find more information on Azure automatic VM guest patching on Microsoft Docs.

How to enable Azure Automatic VM guest OS patching

To enable Azure automatic VM guest OS (operating system) patching, we currently have a couple of requirements.

  • Currently, only Windows VMs are supported (Preview). Currently, Windows Server 2012 R2, 2016, 2019 Datacenter SKUs are supported. (and more are added periodically).
  • Only VMs created from certain OS platform images are currently supported in the preview. Which means custom images are currently not supported in the preview.
  • The virtual machine must have the Azure VM Agent installed.
  • The Windows Update service must be running on the virtual machine.
  • The virtual machine must be able to access Windows Update endpoints. If your virtual machine is configured to use Windows Server Update Services (WSUS), the relevant WSUS server endpoints must be accessible.
  • Use Compute API version 2020-06-01 or higher.

These requirements might change in the future during the preview phase (for the current requirements check out Microsoft Docs).

During the preview, this feature requires a one-time opt-in for the feature InGuestAutoPatchVMPreview per subscription. You can run the following Azure PowerShell or Azure CLI command.

Azure PowerShell:

# Register AzProvider
Register-AzProviderFeature -FeatureName InGuestAutoPatchVMPreview -ProviderNamespace Microsoft.Compute
 
# Check the registration status
Get-AzProviderFeature -FeatureName InGuestAutoPatchVMPreview -ProviderNamespace Microsoft.Compute
 
# Once the feature is registered for your subscription, complete the opt-in process by changing the Compute resource provider.
Register-AzResourceProvider -ProviderNamespace Microsoft.Compute

Now you can enable automatic VM guest patching for your Azure virtual machines within that subscription. To do that you can currently use the REST API, Azure PowerShell, or the Azure CLI.

With Azure CLI, you can use the az vm get-instance-view .

az vm update --resource-group test-autopatch-rg--name azwinvm01 --set osProfile.windowsConfiguration.enableAutomaticUpdates=true osProfile.windowsConfiguration.patchSettings.patchMode=AutomaticByPlatform

You can see that there are two important parameters for this cmdlet. First the -enableAutoUpdate and secondly the -PatchMode. There are currently three different patch orchestration modes you can configure.

AutomaticByPlatform

  • This mode enables automatic VM guest patching for the Windows virtual machine and subsequent patch installation is orchestrated by Azure.
  • Setting this mode also disables the native Automatic Updates on the Windows virtual machine to avoid duplication.
  • This mode is only supported for VMs that are created using the supported OS platform images above.

AutomaticByOS

  • This mode enables Automatic Updates on the Windows virtual machine, and patches are installed on the VM through Automatic Updates.
  • This mode is set by default if no other patch mode is specified.

Manual

  • This mode disables Automatic Updates on the Windows virtual machine.
  • This mode should be set when using custom patching solutions.

If you need more control, I recommend that you have a look at Azure Update Management, which is already publicly available and also supports Windows and Linux servers running in Azure or on-premises.

To verify whether automatic VM guest patching has completed and the patching extension is installed on the VM, you can review the VM’s instance view.

az vm get-instance-view --resource-group test-autopatch-rg --name azwinvm01

This will show you the following result:

Azure Automatic VM Guest OS Patching Status

Azure Automatic VM Guest OS Patching Status

You can also create the patch assessment on-demand.

Invoke-AzVmPatchAssessment -ResourceGroupName "myResourceGroup" -VMName "myVM"

I hope this provides you with an overview of the new Azure automatic VM guest patching feature. If you want to have some advanced capabilities to manage updates for your Azure VMs and even your servers running on-premises, check out Azure Update Management. This will provide you with some advanced settings and your own maintenance schedules. If you have any questions, feel free to leave a comment.



Learn about Windows Server Hybrid and Azure IaaS VMs

Learn Windows Server Hybrid and Azure IaaS VMs

A couple of weeks back I promoted a post about how you can learn about Windows Server on Azure and a post on ITOpsTalk for New Microsoft Learn Modules for Azure and Windows Server IT Pros. This week I got another message by colleague Orin Thomas (Cloud Advocate and Author of the Windows Server 2019 Book), that a lot more Microsoft Learn modules have been published, covering Windows Server Hybrid and Windows Server on Azure IaaS VMs (Infrastructure-as-a-Service).

Learn about Windows Server Hybrid and Windows Server Azure IaaS VMs 🎓

Here is a full list of Microsoft Learn modules to learn about Windows Server Hybrid and Windows Server Azure IaaS VMs (virtual machines). This includes many of the Azure Hybrid Cloud services you can use together with Azure, like Azure Arc, Azure File Sync, Azure Site Recovery, and many more. These Microsoft Learn modules also cover a lot of the Azure Management services to manage your Windows Server virtual machines running on Azure, like Azure Monitor, Azure Update Management, networking, and much more.

I hope you enjoy the new Microsoft Learn modules for Windows Server Hybrid and Windows Server on Azure IaaS. If you have any questions feel free to leave a comment below. If you are looking forward to take some exams, also check out my Microsoft exam study guides, for example for:

Happy Learning!