【发布时间】:2014-02-24 17:50:00
【问题描述】:
我正在尝试使用 .NET 管理库通过 REST API 创建一个虚拟机,但我总是遇到同样的错误。我尝试了 VirtualMachines 操作的 CreateDeployment 和 CreateAsync,但都导致了相同的结果。 代码如下:
ComputeManagementClient computeClient = CloudContext.Clients.CreateComputeManagementClient(credentials);
var status = await computeClient.VirtualMachines.CreateDeploymentAsync("testClService",
new Microsoft.WindowsAzure.Management.Compute.Models.VirtualMachineCreateDeploymentParameters()
{
Name = "test-deployment",
Roles = new List<Role>
{
new Role(){
OSVirtualHardDisk = new OSVirtualHardDisk()
{
DiskName = "testDisk"
},
RoleType = "PersistentVMRole",
RoleName = "testMachine1",
RoleSize = "Medium",
ConfigurationSets = new List<ConfigurationSet>{ new ConfigurationSet()
{
AdminUserName = "ssadmin",
AdminPassword = "testp12334!",
ComputerName = "mycomptest",
ConfigurationSetType = "WindowsProvisioningConfiguration"
}}
}
},
DeploymentSlot = DeploymentSlot.Staging,
Label = "test-deploymentL"
});
CloudService 和 Disk 都存在(我什至可以通过 API 获取它们)。我得到的错误是:
错误请求:在名为 testMachine 的虚拟机的 ConfigurationSet 集合中找到了 ProvisioningConfigurationSet。从 OS 磁盘置备虚拟机时,不得指定 ProvisioningConfigurationSet。
我尝试同时删除 OSVirtualHardDisk 和 ConfigurationSetType 参数,但随后出现错误,表明它们都是必需的。所以似乎API告诉我这两个参数都是必需的,但不能同时存在。 任何帮助将不胜感激。
【问题讨论】:
标签: azure