使用powershell命令在Azure中创建VM时出错

时间:2014-11-13 08:35:55

标签: powershell azure virtual-machine

我正在尝试使用powershell命令在Azure上创建Windows 7 VM

$dclocation = 'East Asia'
$cloudSvcName = 'MyNewCloudServiceName' 
$image = '03f55de797f546a1b29d1b8d66be687a__Windows-7-Enterprise-x64-en.us-201407.01'
$adminPassword = 'Admin@123' 
$vmname = 'MyVMName' 
New-AzureQuickVM -Windows -ServiceName $cloudSvcName -Name $vmname -ImageName $image -Location $dclocation -InstanceSize 'Basic_A0' 

运行上面的代码我收到错误:

New-AzureQuickVM : BadRequest: A ProvisioningConfigurationSet was not found in the ConfigurationSet collection of the virtual machine with name MyVMName. When creating a virtual machine from an image, ProvisioningConfigurationSet must be specified.
At line:4 char:1
+ New-AzureQuickVM -Windows -ServiceName $cloudSvcName -Name $vmname -ImageName $i ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [New-AzureQuickVM], CloudException
    + FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.PersistentVMs.NewQuickVM

先谢谢..

1 个答案:

答案 0 :(得分:1)

您还需要传递-AdminUsername-Password的值,例如

New-AzureQuickVM -Windows `
    -ServiceName $cloudSvcName `
    -Name $vmname `
    -ImageName $image `
    -Location $dclocation `
    -InstanceSize 'Basic_A0' `
    -AdminUsername $adminUsername `
    -Password $adminPassword