Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Java SDK在Azure上创建虚拟机_Azure - Fatal编程技术网

使用Java SDK在Azure上创建虚拟机

使用Java SDK在Azure上创建虚拟机,azure,Azure,我需要从azure java sdk创建虚拟机。我将maven依赖项集成到我的项目中。我需要一个简单的教程。你能帮我吗 谢谢你可以在测试包中使用VirtualMachineOperationsTest类,这里:。最近azure推出了[java api 1.0.0][1]作为稳定版本。我将遵循1.0.0SDK来帮助您创建虚拟机 1. Create a azure authentication file with all credentials subscription=<enter_su

我需要从azure java sdk创建虚拟机。我将maven依赖项集成到我的项目中。我需要一个简单的教程。你能帮我吗


谢谢你可以在测试包中使用VirtualMachineOperationsTest类,这里:。

最近azure推出了[java api 1.0.0][1]作为稳定版本。我将遵循1.0.0SDK来帮助您创建虚拟机

 1. Create a azure authentication file with all credentials

subscription=<enter_subscription>
client=<enter_client>
key=<enter_key>
tenant=<enter_tenant>
managementURI=https\://management.core.windows.net/
baseURL=https\://management.azure.com/
authURL=https\://login.windows.net/
graphURL=https\://graph.windows.net/

2. Get Azure client to perform an operation in azure

`final File credFile = new File("/Users/risanand/cliqr.azureauth");
 Azure azure = Azure.configure()
 .withLogLevel(LogLevel.BASIC)
 .authenticate(credFile)
 .withDefaultSubscription();`

3. Create virtual machine
    `VirtualMachine windowsVM = azure.virtualMachines().define("vmName")
    .withRegion("regionname")
    .withNewResourceGroup("resourceGroupName")
    .withNewPrimaryNetwork("10.0.0.0/28")
    .withPrimaryPrivateIPAddressDynamic()
    .withoutPrimaryPublicIPAddress()                   
    .withAdminUsername(userName)
    .withAdminPassword(password)
    .withNewDataDisk(10)
    .withSize(VirtualMachineSizeTypes.STANDARD_D3_V2)
    .create();`



  [1]: https://github.com/Azure/azure-sdk-for-java

答案中的链接已失效。