Reputation: 551
I'm new to powershell. I refered to http://msdn.microsoft.com/en-us/library/windowsazure/jj152815.aspx example 3. here is my cmd:
$myVM = New-AzureVMConfig -Name "MyVM2" -InstanceSize Extrasmall -ImageName (Get-AzureVMImage)[4].ImageName| Add-AzureProvisioningConfig -VM PersistentVMRole -Windows -Password "Password1!"
| Add-AzureDataDisk -CreateNew -DiskSizeInGB 50 -DiskLabel "DataDisk50" -LUN 0
But I get the error here:
New-AzureVMConfig : A positional parameter cannot be found that accepts argument 'Add-AzureProvisioningConfig'.
At line:1 char:26
+ $myVM = New-AzureVMConfig <<<< -Name "MyVM2" -InstanceSize Extrasmall -ImageName (Get-AzureVMImage)[4].ImageName| A
dd-AzureProvisioningConfig -Windows -Password "Password1!"
| Add-AzureDataDisk -CreateNew -DiskSizeInGB 50 -DiskLabel "
DataDisk50" -LUN 0
+ CategoryInfo : InvalidArgument: (:) [New-AzureVMConfig], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.WindowsAzure.Management.ServiceManagement.IaaS.New
AzureVMConfigCommand
Please can anyone explain why does this example can't be run? I'm going to crazy!
Upvotes: 1
Views: 5167
Reputation: 26
There's a couple of problems with this script:
Some of the VM documentation can contain inconsistencies a much better reference point to get started is Michael Washam's blog http://michaelwasham.com or this may help you if you swap out the sql image for the one you're interested in http://blog.elastacloud.com/2012/06/30/tricks-with-iaas-and-sql-part-1-installing-sql-server-2012-vms-using-powershell/
Upvotes: 1
Reputation: 24895
Try splitting the command over multiple lines, this will help you to pinpoint the actual issue:
$images = Get-AzureVMImage
$imageName = $images[4].ImageName
$vm = New-AzureVMConfig -Name "MyVM2" -InstanceSize Extrasmall -ImageName $imageName
Add-AzureProvisioningConfig -VM $vm -Windows -Password "Password1!"
Add-AzureDataDisk -VM $vm -CreateNew -DiskSizeInGB 50 -DiskLabel "DataDisk50" -LUN 0
Upvotes: 0