Hey there,
I'm trying to go about creating a virtual machine via. the REST API (using the Python wrapper). My code executes successfully, however it is not creating the actual virtual machine. Is this a problem with the Python wrapper or am I missing a step?
I'm following the example here:
http://www.windowsazure.com/en-us/develop/python/how-to-guides/service-management/
My code (with sensitive bits removed):
from azure import * from azure.servicemanagement import * SUBSCRIPTION_ID = 'sid' CERT_PATH = 'path_to_id' sms = ServiceManagementService(SUBSCRIPTION_ID, CERT_PATH) name = 'vmname' location = 'East US' sms.create_hosted_service(service_name=name, label=name, location=location) # Name of an os image as returned by list_os_images image_name = 'image_name' # Destination storage account container/blob where the VM disk # will be created media_link = 'media_link' # Linux VM configuration, you can use WindowsConfigurationSet # for a Windows VM instead linux_config = LinuxConfigurationSet(name, 'user_name', 'password', True) os_hd = OSVirtualHardDisk(image_name, media_link) endpoint_config = ConfigurationSet() endpoint_config.configuration_set_type = 'NetworkConfiguration' endpoint1 = ConfigurationSetInputEndpoint(name='ssh', protocol='tcp', port='22', local_port='22', load_balanced_endpoint_set_name=None, enable_direct_server_return=False) endpoint_config.input_endpoints.input_endpoints.append(endpoint1) sms.create_virtual_machine_deployment( service_name=name, deployment_name=name, deployment_slot='production', label=name, role_name=name, system_config=linux_config, network_config=endpoint_config, os_virtual_hard_disk=os_hd, role_size='ExtraSmall' )
Ok, so I tried posting some straight up XML to see if maybe it was the Python wrapper, no dice. I got a response 202 with no response body, but still no VM in the portal.
XML:
<Deployment xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/windowsazure"><Name>testlinux</Name><DeploymentSlot>Production</DeploymentSlot><Label>testlinux</Label><RoleList><Role i:type="PersistentVMRole"><RoleName>testlinux</RoleName><OsVersion i:nil="true" /><RoleType>PersistentVMRole</RoleType><ConfigurationSets><ConfigurationSet i:type="LinuxProvisioningConfigurationSet"><ConfigurationSetType>LinuxProvisioningConfiguration</ConfigurationSetType><HostName>testlinux</HostName><UserName>azure</UserName><UserPassword>blahblahblah</UserPassword><DisableSshPasswordAuthentication>false</DisableSshPasswordAuthentication></ConfigurationSet><ConfigurationSet i:type="NetworkConfigurationSet"><ConfigurationSetType>NetworkConfiguration</ConfigurationSetType><InputEndpoints><InputEndpoint><LocalPort>22</LocalPort><Name>SSH</Name><Protocol>tcp</Protocol></InputEndpoint></InputEndpoints></ConfigurationSet></ConfigurationSets><DataVirtualHardDisks /><Label>dGVzdGF0b3Rv</Label><OSVirtualHardDisk><MediaLink>http://mymedialink.vhd</MediaLink><SourceImageName>myimagename</SourceImageName></OSVirtualHardDisk><RoleSize>Small</RoleSize></Role></RoleList></Deployment>