0

I'm trying to create a VM using PowerShell in Windows Azure Pack. I've downloaded the subscription, and Get-WAPackVM returns the VM's already created.

I've tried running these two scripts:

$OSDisk = Get-WAPackVMOSDisk -Name "W2012R2 Template_disk_1"
$SizeProfile = Get-WAPackVMSizeProfile -Name "Template"     
New-WAPackVM -Name "ContosoV073" -OSDisk $OSDisk -VMSizeProfile $SizeProfile

and

$Credentials = Get-Credential 
$Template = Get-WAPackVMTemplate -Name "Template 1"
New-WAPackVM -Name "VirShits7" -Template $Template -VMCredential $Credentials -Windows

Both returns the same error:

New-WAPackVM : The remote server returned an error: (400) Bad Request.

All the Get cmdlets return values, and seem to be correct. Anyone know how I get this to work?

arco444
  • 22,002
  • 12
  • 63
  • 67

1 Answers1

0

You may reference the page: https://msdn.microsoft.com/en-us/library/jj643289.aspx

The page say: The key properties that you must set on the virtual machine object that is used with the Service Provider Foundation service are as follows: CloudId, StampId, VMTemplateId ,Name.

You may need to assign CloudId and StampId. I did it by RESTApi and it works.

Adam.Kao
  • 1
  • 2