Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8576713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:59:14+00:00 2026-06-11T19:59:14+00:00

We are trying to create a Virtual Machine through an HTTPClient in Java using

  • 0

We are trying to create a Virtual Machine through an HTTPClient in Java using the REST API exposed by Azure. We are using the following Request URL and XMLs, but we are getting “Bad request” response.

https://management.core.windows.net/{subscription-id}/services/hostedservices/{existing hoster service name}/deployments

<Deployment xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
  <Name>TestVMAnandP</Name>
  <Label>bXl2bQ==</Label>
  <RoleList>
    <Role>
      <RoleName>TestVMAnandP</RoleName>
      <RoleType>PersistentVMRole</RoleType>
      <ConfigurationSets>
        <ConfigurationSet>
          <ConfigurationSetType>LinuxProvisioningConfiguration</ConfigurationSetType>
          <HostName>TestVMAnandP</HostName>
          <UserName>root</UserName>
          <UserPassword>test</UserPassword>
        </ConfigurationSet>
      </ConfigurationSets>
      <DataVirtualHardDisks>
        <DataVirtualHardDisk>
          <Lun>10</Lun>
          <LogicalDiskSizeInGB>50</LogicalDiskSizeInGB>
        </DataVirtualHardDisk>
      </DataVirtualHardDisks>
      <OSVirtualHardDisk>
        <SourceImageName>srini2-srini2-2012-08-23.vhd</SourceImageName>
        <MediaLink>http://sriniteststore.blob.core.windows.net/vhds/srini2-srini2-2012-08-23.vhd</MediaLink>
      </OSVirtualHardDisk>
      <RoleSize>ExtraSmall</RoleSize>
    </Role>
  </RoleList>
  <VirtualNetworkName>MyNetwork</VirtualNetworkName>
</Deployment>

If we try to give a service name same as the vm name in the URL, we are getting 404 Error. We have tried most of the samples given in the web with values replaced, but everything gives us a 400 Error. It would be great if we get some help.

Errors :

Two different kind of errors i am getting :


Error 1 : When i use new <service-name> inside the below URL .management.core.windows.net/<subscription-id>/services/hostedservices/<service-name>/deployments/                          -------------------------------------------------------------------   Response message--->Not Found---404
java.io.FileNotFoundException: management.core.windows.net/84cc18f5-5bdd-4c95-9d69-862c12c53507/services/hostedservices/anand/deployments
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
Caused by: java.io.FileNotFoundException: management.core.windows.net/84cc18f5-5bdd-4c95-9d69-862c12c53507/services/hostedservices/anand/deployments
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)

Error 2 : when i use an existing available <service-name> in the below URL  management.core.windows.net/<subscription-id>/services/hostedservices/<service-name>/deployments/                                                   
Response message--->Bad Request---400
java.io.IOException: Server returned HTTP response code: 400 for URL: management.core.windows.net/84cc18f5-5bdd-4c95-9d69-862c12c53507/services/hostedservices/azurecogservice/deployments
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
Caused by: java.io.IOException: Server returned HTTP response code: 400 for URL: management.core.windows.net/84cc18f5-5bdd-4c95-9d69-862c12c53507/services/hostedservices/azurecogservice/deployments
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)

———————VALID XML————————————————————-

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Deployment xmlns="http://schemas.microsoft.com/windowsazure">
    <Name>190bed4a</Name>
    <DeploymentSlot>Production</DeploymentSlot>
    <Label>190bed4a</Label>
    <RoleList>
        <Role>
            <RoleName>SuseOpenVm_rolec8fc</RoleName>
            <RoleType>PersistentVMRole</RoleType>
            <ConfigurationSets>
                <ConfigurationSet>
                    <ConfigurationSetType>LinuxProvisioningConfiguration
                    </ConfigurationSetType>
                    <HostName>SuseOpenVm_rolec8fc</HostName>
                    <UserName>anandsrinivasan</UserName>
                    <UserPassword>Cloud360</UserPassword>
                    <DisableSshPasswordAuthentication>false</DisableSshPasswordAuthentication>
                </ConfigurationSet>
                <ConfigurationSet>
                    <ConfigurationSetType>NetworkConfiguration</ConfigurationSetType>
                    <DisableSshPasswordAuthentication>false</DisableSshPasswordAuthentication>
                    <InputEndpoints>
                        <InputEndpoint>
                            <LocalPort>22</LocalPort>
                            <Name>SSH</Name>
                            <Port>22</Port>
                            <Protocol>TCP</Protocol>
                        </InputEndpoint>
                    </InputEndpoints>
                </ConfigurationSet>
            </ConfigurationSets>
            <OSVirtualHardDisk>
                <MediaLink>https://portalvhdsvf842yxvkhbg4.blob.core.windows.net/vhds/190bed4a.vhd</MediaLink>
                <SourceImageName>SUSE__openSUSE-12-1-20120603-en-us-30GB.vhd</SourceImageName>
            </OSVirtualHardDisk>
            <RoleSize>Small</RoleSize>
        </Role>
    </RoleList>
    <VirtualNetworkName>anand360NW</VirtualNetworkName>
</Deployment>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T19:59:15+00:00Added an answer on June 11, 2026 at 7:59 pm

    I have been working on the same thing a while back.

    i suggest you check out my implementation of a java REST client that consumes this API at the Cloudify GitHub repo:

    https://github.com/CloudifySource/cloudify/blob/master/esc/src/main/java/org/cloudifysource/esc/driver/provisioning/azure/client/MicrosoftAzureRestClient.java

    another good reference is the node.js sdk provided my Microsoft. you can browse the code and see where you went wrong :

    https://github.com/WindowsAzure/azure-sdk-for-node/blob/master/lib/services/serviceManagement/servicemanagementservice.js

    hope it helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create Java Virtual Machine in a cplusplus program using the
I am trying to create a virtual machine using libvirt using the command: virsh
Trying to create a virtual machine using VMPlayer, I discovered that as the Chrome
I am trying to create a Java virtual machine from C++ and invoke the
I am trying to create a virtual directory and set it's permissions using IIS7
I'm trying to create a new TFS workspace in my CentOS virtual machine, in
I am trying to create virtual desktop. I complete successfully.But i am not able
I'm trying to create a virtual host in apache so I can access a
My httpd-vhosts.conf file looks something like this. I am trying to create 2 virtual
I'm trying create a bot which automatically likes Facebook posts. Using Mechanize I can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.