Quantcast
Channel: BizTalkGurus
Viewing all articles
Browse latest Browse all 2977

Blog Post: Working with Windows Azure Virtual Machines using the Windows Azure REST API

$
0
0

Windows Azure has a rich Management REST API for working with all types of artifacts. 

Continuing on with my current theme of working with the Windows Azure Virtual Machines in Preview mode I came across some details of the REST API that might be helpful to others.  While the documentation seem to say for GET and DELETE requests you need something like the following:

https://management.core.windows.net/<subscription-id>/services/hostedservices/<service-name>/deployments/<deployment-name>/roles/<role-name>

The only way I have been able to get GET and DELTET requests to work is using “deploymentslots” rather than “deployments”.  Below are some samples of REST API URLs that I was able to get working.  For POST requests, the below URL was used for sending in a Request Body with additional XML payload details.

The Service Name listed below is the Virtual Machine Name witch is usually the same as the underlying Service (although it does not have to be).  When deleting, the Hosted Service used by the Virtual Machine may also need to be deleted.

To Get Virtual Machine Details – HTTP GET

https://management.core.windows.net/<Subscription-ID>/services/hostedservices/<Service-Name>/deploymentslots/Production

To Delete a Virtual Machine – HTTP DELETE

https://management.core.windows.net/<Subscription-ID>/services/hostedservices/<Service-Name>/deploymentslots/Production

Make sure to clean up the Service – HTTP DELETE

https://management.core.windows.net/<Subscription-ID>/services/hostedservices/<Service-Name>

To Import a VM State (exported using PowerShell): – HTTP POST with Post Body

https://management.core.windows.net/<Subscription-ID>/services/hostedservices/<Service-Name>/deployments

To use Quick Create or Create a New Virtual Machine: – HTTP POST with Post Body

https://management.core.windows.net/<Subscription-ID>/services/hostedservices/<Service-Name>/deployments

Hope this helps someone else trying to use the Windows Azure REST API with Virtual Machines.


Viewing all articles
Browse latest Browse all 2977

Trending Articles