title | description | services | documentationcenter | author | manager | editor | tags | ms.assetid | ms.service | ms.devlang | ms.topic | ms.tgt_pltfrm | ms.workload | ms.date | ms.author | ms.custom |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Azure PowerShell Script Sample - Create a Windows VM | Microsoft Docs |
Azure PowerShell Script Sample - Create a Windows VM |
virtual-machines-windows |
virtual-machines |
cynthn |
jeconnoc |
tysonn |
azure-service-management |
virtual-machines-windows |
na |
sample |
vm-windows |
infrastructure |
03/02/2017 |
cynthn |
mvc |
This script creates an Azure Virtual Machine running Windows Server 2016. After running the script, you can access the virtual machine over RDP.
[!INCLUDE sample-powershell-install]
[!INCLUDE quickstarts-free-trial-note]
[!code-powershellmain]
Run the following command to remove the resource group, VM, and all related resources.
Remove-AzureRmResourceGroup -Name myResourceGroup
This script uses the following commands to create the deployment. Each item in the table links to command specific documentation.
Command | Notes |
---|---|
New-AzureRmResourceGroup | Creates a resource group in which all resources are stored. |
New-AzureRmVirtualNetworkSubnetConfig | Creates a subnet configuration. This configuration is used with the virtual network creation process. |
New-AzureRmVirtualNetwork | Creates a virtual network. |
New-AzureRmPublicIpAddress | Creates a public IP address. |
New-AzureRmNetworkSecurityRuleConfig | Creates a network security group rule configuration. This configuration is used to create an NSG rule when the NSG is created. |
New-AzureRmNetworkSecurityGroup | Creates a network security group. |
Get-AzureRmVirtualNetworkSubnetConfig | Gets subnet information. This information is used when creating a network interface. |
New-AzureRmNetworkInterface | Creates a network interface. |
New-AzureRmVMConfig | Creates a VM configuration. This configuration includes information such as VM name, operating system, and administrative credentials. The configuration is used during VM creation. |
New-AzureRmVM | Create a virtual machine. |
Remove-AzureRmResourceGroup | Removes a resource group and all resources contained within. |
For more information on the Azure PowerShell module, see Azure PowerShell documentation.
Additional virtual machine PowerShell script samples can be found in the Azure Windows VM documentation.