Question
Yauhen.F on Thu, 27 Feb 2014 17:24:30
Hello,
I am using rest api for creating vritual machines/deployments. By some strange reason InputEndpoints are ignored end not set. I use azure sdk for .net as wrapper for rst calls. All other settings seem to me applied correctly. Here is code fragment
client.VirtualMachines.BeginCreatingDeployment("service",
new VirtualMachineCreateDeploymentParameters
{
Name = "testVM",
Label = "testVM",
DeploymentSlot = DeploymentSlot.Staging,
Roles = new List<Role>
{
new Role
{
RoleName = "testVM",
RoleType = "PersistentVMRole",
Label = "testVM",
RoleSize = "ExtraSmall",
ConfigurationSets = new List<ConfigurationSet>
{
new ConfigurationSet
{
AdminUserName = "Administrator2",
AdminPassword = "Password@134",
ComputerName = "testVM",
ConfigurationSetType = "WindowsProvisioningConfiguration",
HostName = "testVM",
InputEndpoints = new List<InputEndpoint>
{
new InputEndpoint
{
Name = "Remote Desktop",
LocalPort = 3389,
Port = 53729,
Protocol = "tcp"},
new InputEndpoint
{
Name = "PowerShell",
LocalPort = 5986,
Port = 5986,
Protocol = "tcp",
}
}
}
},
OSVirtualHardDisk = new OSVirtualHardDisk
{
SourceImageName = "image.Name",
MediaLink = "http://...vhdd"
}
}
}
Replies
Will Shao on Fri, 28 Feb 2014 08:44:55
hi Yauhen,
Did you check and debug the Request Body? I am not sure your input endpoints setting is in the "NetworkConfigurationSet" node. You could use fiddler to debug the request.
<ConfigurationSet i:type="NetworkConfigurationSet"> <ConfigurationSetType>NetworkConfiguration</ConfigurationSetType> <InputEndpoints> <InputEndpoint> <LocalPort>3389</LocalPort> <Name>RemoteDesktop</Name> <Protocol>tcp</Protocol> </InputEndpoint> </InputEndpoints> </ConfigurationSet> </ConfigurationSets>
Also, you could refer to those code sample about use rest api create vm (http://code.msdn.microsoft.com/windowsazure/Simple-Windows-Azure-REST-b8200322).
Regards,
Will