@@ -52,22 +52,40 @@ The `SimpleParameterSet` provides a convenient method to create a VM by making c
52
52
53
53
### Example 1: Create a virtual machine
54
54
```
55
- PS C:\> New-AzureRmVM -Name MyVm
55
+ PS C:\> New-AzureRmVM -Name MyVm -Credential (Get-Credential)
56
+
57
+ VERBOSE: Use 'mstsc /v:myvm-222222.eastus.cloudapp.azure.com' to connect to the VM.
58
+
59
+ ResourceGroupName : MyVm
60
+ Id : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyVm/provi
61
+ ders/Microsoft.Compute/virtualMachines/MyVm
62
+ VmId : 11111111-1111-1111-1111-111111111111
63
+ Name : MyVm
64
+ Type : Microsoft.Compute/virtualMachines
65
+ Location : eastus
66
+ Tags : {}
67
+ HardwareProfile : {VmSize}
68
+ NetworkProfile : {NetworkInterfaces}
69
+ OSProfile : {ComputerName, AdminUsername, WindowsConfiguration, Secrets}
70
+ ProvisioningState : Succeeded
71
+ StorageProfile : {ImageReference, OsDisk, DataDisks}
72
+ FullyQualifiedDomainName : myvm-222222.eastus.cloudapp.azure.com
56
73
```
57
74
58
75
This example script shows how to create a virtual machine.
76
+ The script will ask a user name and password for the VM.
59
77
This script uses several other cmdlets.
60
78
61
79
### Example 2: Create a virtual machine from a custom user image
62
80
```
63
81
PS C:\> ## VM Account
64
82
# Credentials for Local Admin account you created in the sysprepped (generalized) vhd image
65
83
$VMLocalAdminUser = "LocalAdminUser"
66
- $VMLocalAdminSecurePassword = ConvertTo-SecureString "Password" -AsPlainText -Force
84
+ $VMLocalAdminSecurePassword = ConvertTo-SecureString "Password" -AsPlainText -Force
67
85
## Azure Account
68
86
$LocationName = "westus"
69
87
$ResourceGroupName = "MyResourceGroup"
70
- # This a Premium_LRS storage account.
88
+ # This a Premium_LRS storage account.
71
89
# It is required in order to run a client VM with efficiency and high performance.
72
90
$StorageAccount = "Mydisk"
73
91
@@ -77,9 +95,9 @@ $ComputerName = "MyClientVM"
77
95
$OSDiskUri = "https://Mydisk.blob.core.windows.net/disks/MyOSDisk.vhd"
78
96
$SourceImageUri = "https://Mydisk.blob.core.windows.net/vhds/MyOSImage.vhd"
79
97
$VMName = "MyVM"
80
- # Modern hardware environment with fast disk, high IOPs performance.
98
+ # Modern hardware environment with fast disk, high IOPs performance.
81
99
# Required to run a client VM with efficiency and performance
82
- $VMSize = "Standard_DS3"
100
+ $VMSize = "Standard_DS3"
83
101
$OSDiskCaching = "ReadWrite"
84
102
$OSCreateOption = "FromImage"
85
103
@@ -97,7 +115,7 @@ $Vnet = New-AzureRmVirtualNetwork -Name $NetworkName -ResourceGroupName $Resourc
97
115
$PIP = New-AzureRmPublicIpAddress -Name $PublicIPAddressName -DomainNameLabel $DNSNameLabel -ResourceGroupName $ResourceGroupName -Location $LocationName -AllocationMethod Dynamic
98
116
$NIC = New-AzureRmNetworkInterface -Name $NICName -ResourceGroupName $ResourceGroupName -Location $LocationName -SubnetId $Vnet.Subnets[0].Id -PublicIpAddressId $PIP.Id
99
117
100
- $Credential = New-Object System.Management.Automation.PSCredential ($VMLocalAdminUser, $VMLocalAdminSecurePassword);
118
+ $Credential = New-Object System.Management.Automation.PSCredential ($VMLocalAdminUser, $VMLocalAdminSecurePassword);
101
119
102
120
$VirtualMachine = New-AzureRmVMConfig -VMName $VMName -VMSize $VMSize
103
121
$VirtualMachine = Set-AzureRmVMOperatingSystem -VM $VirtualMachine -Windows -ComputerName $ComputerName -Credential $Credential -ProvisionVMAgent -EnableAutoUpdate
@@ -287,7 +305,7 @@ Specifies a license type, which indicates that the image or disk for the virtual
287
305
This value is used only for images that contain the Windows Server operating system.
288
306
The acceptable values for this parameter are :
289
307
290
- - Windows_Client
308
+ - Windows_Client
291
309
- Windows_Server
292
310
293
311
This value cannot be updated.
0 commit comments