The following table provides links to PowerShell script samples that create and manage Windows virtual machines (VMs).
Create virtual machines | |
Creates a resource group, a virtual machine, and all related resources, with a minimum of prompts. | |
Creates a resource group, a virtual machine, and all related resources. | |
Creates several virtual machines in a highly-available and load-balanced configuration. | |
Creates a virtual machine and uses the Azure Custom Script extension to install IIS. | |
Creates a virtual machine and uses the Azure Desired State Configuration (DSC) extension to install IIS. | |
Uploads a local VHD file to Azure, creates an image from the VHD, and then creates a VM from that image. | |
Creates a virtual machine by attaching an existing Managed Disk as OS disk. | |
Creates a virtual machine from a snapshot by first creating a managed disk from the snapshot and then attaching the new managed disk as OS disk. | |
Manage storage | |
Creates a managed disk from a specialized VHD as an OS disk, or from a data VHD as a data disk, in the same or a different subscription. | |
Creates a managed disk from a snapshot. | |
Copies a managed disk to the same or a different subscription that is in the same region as the parent managed disk. | |
Exports a managed snapshot as a VHD to a storage account in a different region. | |
Exports the underlying VHD of a managed disk to a storage account in a different region. | |
Creates a snapshot from a VHD and then uses that snapshot to create multiple identical managed disks quickly. | |
Copies snapshot to the same or a different subscription that is in the same region as the parent snapshot. | |
Secure virtual machines | |
Creates an Azure key vault, an encryption key, and a service principal, and then encrypts a VM. | |
Monitor virtual machines | |
Creates a virtual machine, installs the Azure Log Analytics agent, and enrolls the VM in a Log Analytics workspace. |