Windows Azure REST API Sample and Tool – GET, POST, & DELETE with One Click

Windows Azure has a few different, somewhat disjointed, toolsets available to create new artifacts and maintain existing ones.  The best known is the Web Portal.  Very quickly when working with the web portal you discover the portal is not able to do all the tasks needed to support development and maintenance.  This brings into play Windows Azure PowerShell Commands, a .Net SDK, and REST API. 

If you are new to working with the Windows Azure REST API or if you are looking for sample code working with the Windows Azure REST API, this tool can help you.

This tool is intended to get you moving in the right direction and not intended to solve all your problems out of the box.  You will need to use the Windows Azure REST API Reference guide when working with this tool. 

I have provided a few sample Request Body templates for Creating a Hosted Service, Creating an Azure Storage Account, Adding a Virtual Machine Disk, and Creating a Virtual Machine (note to create a VM is a multi-step process, see below).  Others can easily be added by using the online reference guide.

Download: Windows Azure REST API Sample Tool

To use this sample tool you need to configure some basic information inside the App.Config file.  You need to set the path to your management certificate, your subscription id, and the path to the folder location of your POST bodies. 

    <!--  Enter the full path to the Windows Azure Management Certificate. More details at http://msdn.microsoft.com/en-us/library/windowsazure/ee460782.aspx -->
    <add key='CertificatePath' value='C:\DemoFolder\yourcert.cer'/>

    <!-- Subscription ID for the account and must match Management Certificate -->
    <add key='Subscription' value='your account id' />

    <!--  Default folder location of REST API Post Bodies.  This exists to save time selecting the Post Body file. -->
    <add key='PostBodiesFolder' value='C:\DemoFolder\WindowsAzureRESTApiHelper\WindowsAzureRESTApiHelper\RESTAPIBodies\'/>

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }



How to Use this Sample Tool

1.  Once the App.config is setup simply launch the tool.  It was built with Visual Studios 2010 but should upgrade to 2012 without issues.

2.  Select one of the GET, POST, or DELETE radio buttons. 

3.  Select your basic action from the drop down or paste in your URL into the text box.

4.  Click on “Make A REST Service Call” to complete your request. 

5.  If you are doing a POST, you will be prompted to select the body of your request.

6.  If you do a POST or a DELTE that is an asynchronous process a Request ID is returned in the Response Header.  The tool will detect this and auto populate a URL to check the result of the request.

7.  You can keep clicking the “Make REST Service Call” button to check the results of the submitted operation until it is competed. 

It is that simple!!!  Like I said before, this tool is intended to be a starting point for someone new to working with the Windows Azure REST API’s. 



Download:
Windows Azure REST API Sample Tool



Other useful pieces of information

1.  To create a new Virtual Machine you need to do the following: First, create the Service using Create Hosted Service.  Second, you can use the Quick Create using that Service to create the Virtual Machine.

2.  If you plan to work with Virtual Machines using the API, read this blog post about the URLs.

3.  If you run into issues the best way to confirm the URL and Post Body is to perform the actions using PowerShell with Fiddler running.  This will show the URL and exact Post Body. 

Trying Out the New Windows Azure Portal Support for Relay Services

Trying Out the New Windows Azure Portal Support for Relay Services

Scott Guthrie announced a handful of changes to the Windows Azure Portal, and among them, was the long-awaited migration of Service Bus resources from the old-and-busted Silverlight Portal to the new HTML hotness portal. You’ll find some really nice additions to the Service Bus Queues and Topics. In addition to creating new queues/topics, you can […]
Blog Post by: Richard Seroter

Window Azure Preview Portal Enhancements for Virtual Machines, Disks, Service Bus, and More

Some enhancements were made this weekend to the Windows Azure Preview Portal.  With these enhancements is the addition of Service Bus features and I think the ability to create Containers inside a Storage Account.  I do not remember that being in place before.

As it relates to Virtual Machines I noticed the following two changes:

1.  When you Capture An Image from an existing Virtual Machine you get a notice saying the Virtual Machine will be deleted.

2.  When you delete a DISK you are now giving the option to also delete the underlying blob storage vhd associated with that DISK.  This is a nice, money saving feature.

On a side note, it seems the ability to create and capture an Image is no longer working.  I have been trying since Friday with no luck.  It was working a few weeks ago.  So if you are trying to create an Image you may run into issues.

Working with Windows Azure Virtual Machines using the Windows Azure REST API

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>

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

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

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

To Delete a Virtual Machine – HTTP DELETE

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

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

Make sure to clean up the Service – HTTP DELETE

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

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

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

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

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

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

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

BizTalk Environments User Access Policy/Security Best Practices using BizTalk360

One of the largest oil company in the world purchased BizTalk360 purely to stream line their BizTalk environments user access policy.  We been working with this company for nearly last 11 months, with various meetings, demos and POC and finally they decided BizTalk360 will solve their current challenges and save them lot of time as […]

The post BizTalk Environments User Access Policy/Security Best Practices using BizTalk360 appeared first on BizTalk360 Blog.

Blog Post by: Saravana Kumar

Windows 8 is the Super workstation OS I had been waiting for

Long back I had written a blog post about Using Windows Server 2008 as a SUPER workstation OS that caused a lot of buzz

Server 2008: The Windows Workstation we always wanted

Review: Using Windows Server 2008 on a PC

I had my reasons to use a Server OS on my work laptop and have been doing it since Windows Server 2003. When I wrote that blog post I had a vision of Windows which I now think has become a reality.

After nearly 9 years I have made my switch to a desktop version of Windows. My work laptop now has Windows 8 (RTM).

And before you drift into the world of Touch and Apps. My laptop doesn’t have a Touch Screen. I am still a mouse and keyboard guy.

Search and Launch is way better than the Start Button

I am surprised at the number of hard core Start Button fans. The most common use of the Start Button was to launch apps. I had ditched the Start Menu long back for the Search Bar. Simply because my “All Programs” list had grown to three columns.

To launch any program I would just hit Start and type the first few characters of the program I wanted to run. Say you want to launch Paint Just hit the Windows button and type in “pa..” and hit Enter.

With Windows 8 it becomes better You can search Apps, Settings and Files in one place. You can also launch search within apps. Like search within the Store App.

I have seen a lot of people use Search to launch Apps than actually traversing the “All Programs” list.

And in case you can’t do without it here is a tip I learnt. You can create a Custom Toolbar and point it to C:\ProgramData\Microsoft\Windows\Start Menu\Programs. You will get a list similar to “All Programs”

Searching and Launching Apps is way faster than clicking the Start Button and traversing the list. And its not just for power users. Say you want to change the Sounds your computer makes. Now instead of knowing that you have to open the Control Panel you can just hit the Windows button and type in Sound. You will be given a list of Apps and Settings related to Sound. Go to the Settings section and you can now easily change the Sound Settings.

The most unexpected outcome of the new Start Screen for me Its strange but a Start Screen that covers the entire screen is something I didn’t realize I was missing all these days. There have been a lot of instances when I have been working on something confidential and a colleague walks by your desk. I am pretty sure a lot of people have been in this situation. You struggle to hit the Minimize button with your mouse or try to switch to some other app or hit Ctrl+M or (and I have seen this happen) just turn off the screen. Now I just hit the Windows Key and voila the entire screen is covered.

And the concept of Tiles which display updates is also very useful.

Virtualization ! Virtualization on my workstation is a must have for me. A lot of people think virtualization is not something meant for a client OS.

Fist it enables me to break and restore as many times as I need. I now have a Windows 2008 R2 server running virtualized on my Windows 8 machine. I can do all my risky experimentation on my VPC and even if I end up rendering the VPC unusable I can just restore back to an earlier snapshot.

Since the host machine can be networked to the virtual PCs you can partition your software. Move all your heavy software like SQL Server to a virtual PC and it can be access by the host machine like a regular networked machine. The advantage ? you can save /turn off the virtual PC releasing all the resources when not in use.

You no longer have to deal with the limitations of Virtual PC or Virtual Box you get Hyper V with Windows 8.

One problem with enabling Hyper V on Windows 2008 R2 was that the machine would no longer Sleep or Hibernate. With Windows 8 there are no such restrictions. I can just close my laptop lid and even with Virtual Machines running, the laptop goes into Sleep mode. You lift the lid and your virtual machines are up and running where you left them.

For Hyper V you would need the Pro / Enterprise edition and a machine with SLAT.

Apps are not just for phones and tablets Initially you might be averse to Apps, the concept of having two different types of applications might sound a bit strange. For me the concept of Apps is simple its controlled software. The last time you installed a game from the internet did you bother to check if it used your location information or connected to the network ? Not really right now think of all the consequences because of that. When you download an app from the Store it clearly warns you about what the app can access like use your internet connection. The Apps run in a Sandbox and that way are very safe. We all download small apps like games or utilities from unknown sources doing it from the Store is safer as all Apps in the Store are verified.

For me the most used App is the Reader. You no longer have to install a software for reading PDFs. I no longer have to choose between Adobe and FoxIt I love the simplicity of the Reader.

Multitask Without InterruptionsThe Snap View is very useful for multitasking. You can keep an eye on the stock market while doing you regular work on your Desktop.

The Duplicates One thing that you might find strange is that you now have two Internet Explorers. But what I have seen is that depending on who uses the computer eventually one will take over. For me the Desktop IE is the preferred choice because some of our corp websites require ActiveX plugins. But on my home PC the new IE gets used a lot. The new IE is better both in terms of presentation and safety. Having duplicates is not a big deal a lot of people install multiple browsers and media players on their desktop but eventually.

The simple things like Using Corners instead of button clicks saves you a lot of time. And its doesn’t take long to adapt to it.

One feature I always missed was the ability to mount ISOs. Now with Windows 8 you can mount ISO files and VHDs easily.

Windows 8 has a lot of features in it for both the power user and a normal user.

Its Smarter than you think I was pleasantly surprised by what Windows 8 does in the background.  I have been using Windows 8 for nearly two months now and my disks have 0 fragmentation which basically means better performance. The best part is I never knew when it defragmented those disks (until of course I looked at the Last Run column) because it never interrupted my work and carried out this maintenance work when the machine was idle.

Even without all the Touch goodness Windows 8 still puts on a great show.

Blog Post by: Shinva