我正在尝试使用Azure Java SDK部署VM。我可以通过Java从Azure门户中检索列表。
尝试部署VM时,它会在函数中要求部署名称:
computeManagementClient.getVirtualMachinesOperations()。create(String,String,VirtualMachineCreateParameters);
第二个字符串应该是部署名称,在哪里可以找到Azure门户中应该包含的内容,或者如何创建部署名称容器?
我已经尝试了几个我认为可能正确的名称并获得例外:
Exception in thread "main" java.util.concurrent.ExecutionException: com.microsoft.windowsazure.exception.ServiceException: ResourceNotFound: The deployment name 'thundertest' does not exist.
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:188)
at com.microsoft.windowsazure.management.compute.VirtualMachineOperationsImpl.create(VirtualMachineOperationsImpl.java:5359)
at com.thunderhead.cloudlib.azure.RequestBuilder.createVirtualMachines(RequestBuilder.java:344)
at com.thunderhead.cloudlib.azure.RequestBuilder.main(RequestBuilder.java:365)
Caused by: com.microsoft.windowsazure.exception.ServiceException: ResourceNotFound: The deployment name '<deploymentName?>' does not exist.
at com.microsoft.windowsazure.exception.ServiceException.createFromXml(ServiceException.java:216)
at com.microsoft.windowsazure.management.compute.VirtualMachineOperationsImpl.beginCreating(VirtualMachineOperationsImpl.java:1884)
at com.microsoft.windowsazure.management.compute.VirtualMachineOperationsImpl$3.call(VirtualMachineOperationsImpl.java:1038)
at com.microsoft.windowsazure.management.compute.VirtualMachineOperationsImpl$3.call(VirtualMachineOperationsImpl.java:1035)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
答案 0 :(得分:0)
首先调用computeManagementClient.getVirtualMachinesOperations().createDeployment()
应该为您提供一个部署对象,其名称可以传递给computeManagementClient.getVirtualMachinesOperations().create
。