I am working on a project which requires to create a VM in azure. I have worked on AWS where I can use the AWS api to programatically create a VM in AWS. Can I do the same on Azure?
Yes, you can programmatically create VMs in Windows Azure by consuming Windows Service Management REST API
. I wrote a blog post some days ago about consuming this API using Java which you can read here: http://gauravmantri.com/2013/08/25/consuming-windows-azure-service-management-api-in-java/ . You just have to write code for consuming appropriate operations available in Service Management API.
My team has recently put out some major updates to the Java SDK and what's available in service management areas in our 0.6.0 release. You can check out the README in our repository to see a detailed of what all the SDK can do, and this post provides some guidance on getting started with the service management SDK using Maven and Eclipse.
Check this link for authenticating a java program in azure .
Here is a sample piece of code from Azure SDK for creating a Linux virtual
VirtualMachine linuxVM = azure.virtualMachines().define("myLinuxVM")
.withRegion(Region.US_EAST)
.withNewResourceGroup("myResourceGroup")
.withNewPrimaryNetwork("10.0.0.0/28")
.withPrimaryPrivateIpAddressDynamic()
.withNewPrimaryPublicIpAddress("mylinuxvmdns")
.withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_16_04_LTS)
.withRootUserName("tirekicker")
.withSsh(sshKey)
.withSize(VirtualMachineSizeTypes.STANDARD_D3_V2)
.create();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.