Windows Azure

Silicon Valley Code Camp 2013 – Windows Azure Mobile Services


The Silicon Valley Code Camp is the biggest free conference of the Silicon Valley. On October 5th and 6th, come to learn about any technology (not only Microsoft) at the Foothill College in Los Altos Hills, CA. And this year, I have the change to speak with Eugene Chuvyrov (@EugeneChuvyrov) about Windows Azure Mobile Services. We will show you how to integrate Azure Mobile Services in your existing applications running iOS and Windows Phone.

Fast & Furious iOS and Windows Phone development with Azure Mobile Services

Time to market is critical in mobile application development, and new cloud-based technologies are here to help you get your apps out the door faster. By abstracting back-end operations and using a powerful SDK, Windows Azure Mobile Services allows you to focus on creating beautiful native User Interfaces on the web (HTML 5), iOS, Android, Windows Phone and Windows 8 devices and coding custom logic for these platforms. In this presentation, Eugene Chuvyrov and Fabien Lavocat will demonstrate how a single backend hosted on Windows Azure Mobile Services powers both iOS and Windows Phone devices. Taking advantage of the data from Dun & Bradstreet Developer Challenge, they will demonstrate a mobile CRM system that they created for these platforms.

I am speaking at silicon valley code camp. Please come to my session!  Click here for details.

New Windows Azure Benefits for MSDN Subscribers


Microsoft is presenting Windows 8.1 update at TechEd North America in New Orleans, LA and at the same time published information about Visual Studio 2013 and new benefits about Windows Azure for MSDN Subscribers.

Some highlights I want to share with you:

  • Microsoft is now charging Virtual Machines, Web and Worker roles, per-minute.
  • You will not be charged if your Virtual Machine is stopped. All your deployment state is preserved.

Monthly Windows Azure Credits and usage

After a first month with $200 credit for any MSDN subscriber, depending on your subscription level (Professional, Premium or Ultimate) you will get respectively $50, $100 or $150 to use for any Windows Azure service for dev/test purpose. And that’s the big point here. You are not anymore allowed to use your MSDN subscription to publish any Windows Azure service for production purpose. If you still want to be able to do so, you will need to refuse the new offer, sign into the account portal, and next to your Windows Azure MSDN subscription you will find the option to opt out of the conversion. Microsoft BizSpark Startups are not concerned by the dev/test purpose limitation. Get more information regarding the BizSpark program.

MSDN Rates for Windows Azure

On top of the new credit based account, MSDN subscribers will also benefit from lower rates for some services. A picture is more efficient that a long text, so here are the discounts you will be able to enjoy.


MSDN Software

Another great thing coming with this announcement is that you are now allows to use your MSDN licenses on Windows Azure. In other words, you can publish a Virtual Machine with any software coming from your MSDN account. (except client OS)

Send a web request to a Web Site periodically using Azure Mobile Services

Mobile Services

Today I’m facing a new challenge with IIS (Internet Information Service) of one of my Web Site on Windows Azure. As you probably know, after a few minutes of inactivity, IIS will go take a nap and will wake up at the next incoming request. It means after about 15 – 20 minutes, if your web site did not receive any incoming request it will pause itself. And the following request will take longer because the web server needs to start. It can be a problem for the guests visiting your web site or consuming your services. One solution is to use Windows Azure Mobile Services and more precisely the Scheduler feature.

Just to remind you, Azure Mobile Services is free, up to 10 services, using shared instances. So let’s use it!

Continue reading

Global Windows Azure Bootcamp – Mobile Services for Earthquakes

GWAB Mobile Services

Saturday April 27th, 2013 was the day of the Global Windows Azure Bootcamp (GWAB). With more than 90 locations all around the world, GWAB was THE world-wide event about Windows Azure. Thanks to @RobinDotNet I had the chance to give a 15 minute presentation on how I use Windows Azure Mobile Services in my application Earthquakes for Windows Phone. Today I’m going to share with you, on this blog, my presentation and at the same time, add some details and answer some questions I received after the talk.

Continue reading

Windows Azure – How to delete a Virtual Machine properly

Azure Virtual Machines
If like me you’re playing more and more with Windows Azure, you’ve probably faced some issues with the Windows Azure Manager. Sometimes the problem is that you can’t find easily how to do a task. The last one I’ve been exposed is that I couldn’t delete the hard drive (vhd) use by an old virtual machine. Because when you create a new Virtual Machine, you’re prompted for a storage, I was guessing that I will just have to go to the storage I’ve created to store my machine, then open the container vhds and simply delete the blob. Unfortunately, there is a lock on the file, even if there is no VM using it:

VHD Metadata

So when you try to delete this blob, you’ll get this error message in the portal:

VHD Delete Error

The reason is simple, the lock comes from the management portal. Here is the “good way” to delete a Virtual Machine and the associated resources.

  • First, delete the Virtual Machine by going to the list of Virtual Machines, select the one you want to delete, then click Delete.
  • Once the VM is deleted, go to Virtual Machines | DISKS you will notice that the vhd is still here but not attached to anything. That’s good because you can still create a new VM with the same hard drive later on. Vhd Disks
  • From this screen, and this one only, you can delete the disk. Select the disk and click DELETE in the list of actions at the bottom of the page. In the new menu, click Delete the associated VHD. Vhd Delete Disk
  • A Cloud Service has also been created with your Virtual Machine. It can be used when you have multiple machines for a single service. If you don’t use it, you can delete it.
  • If you don’t need the storage created for this Virtual Machine, you can also delete it.
  • You’re done, you have cleaned your Windows Azure from the Virtual Machine.

Azure Mobile Services – Paging with REST APIs

Mobile Services
I would like to complete the code I’ve provided to call the REST APIs for Windows Azure Mobile Services in my two previous posts, Introduction to Windows Azure Mobile Services and Windows Azure Mobile Services – Update with REST APIs. Today, I’ve been facing a basic mistake I made for my application Earthquakes. You are more and more everyday to use this application, and I thank you for that :). Each time a new user start the application, the app will register on Azure Mobile Services in order to update the Live Tile on the Phone (see the picture below). It means I store a list of URLs on Mobile Services, and I’ll contact these URLs to update the Live Tile on your phone.

Earthquakes Live Tiles
If you’ve read and use the source code I’ve provided you’ve probably noticed an issue. How do you retrieve a list of more than 50 entries in Mobile Services? You have two possibilities:

  • The first idea would be to increase the number of items you want to retrieve when you call the REST API. In order to do that you have to specify the parameter $top of the REST API. You can ask up to 1000 items in one call. But what’s going on if you have more than a thousand items in your base? You’ll simply never get them and it’s what happened to me. I was stuck with the 50 firsts items…
    URL format: https://<ServiceName><TableName>?$top=<Limit>
  • The other idea and probably the better in most of the cases, is to use paging. The paging capability allows you to retrieve your elements by lot, 50 at a time for example, until you have all of them. To do so, we will combine the attributes $top and $skip. Also, by using the attribute $inlinecount with the value allpages we will get the number of elements in the table at each call. It will help us to track if we need to perform more call to get more elements.
    URL format: https://<ServiceName><TableName>?$top=<Limit>&$skip<Skip>&$inlinecount=allpages

Let’s start coding with a class named RestResult that we will use to deserialize the elements including the number of elements in the table.

public sealed class RestResult<T>
    where T : class
    [DataMember(Name = "results")]
    public T[] Results { get; set; }

    [DataMember(Name = "count")]
    public int Count { get; set; }

Now, we can update the function Get to retrieve an object RestResult<T> that will contain the list of elements we asked and the number of elements in the table.

public RestResult<T> Get<T>(string tableName, string filter = "", int skip = 0, int top = 50)
    where T : class
    if (!string.IsNullOrWhiteSpace(filter))
        filter = string.Concat("&$filter=", filter);

    Uri address = new Uri(string.Format("https://{0}{1}?$inlinecount=allpages&$skip={2}&$top={3}{4}",
                                        ServiceName, tableName, skip, top, filter));

    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(address);

    request.Method = "GET";
    request.Headers = new WebHeaderCollection
                                {"X-ZUMO-APPLICATION", ApplicationId},
                                {"X-ZUMO-MASTER", MasterKey},

    RestResult<T> result;

    using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
        Stream stream = response.GetResponseStream();

        result = stream.Deserialize<RestResult<T>>();

    return result;

And to finish, here is the code that will retrieve all the elements of a table.

public IEnumerable<T> GetAll<T>(string tableName, string filter = "")
    where T : class
    List<T> result = new List<T>();
    bool needMore;

        var get = Get<T>(tableName, filter, result.Count);

        needMore = get.Count > result.Count;
    } while (needMore);

    return result;

Monitoring the Cloud Services, Websites, Mobile Services and Virtual Machines


Windows Azure is evolving very fast. I don’t remember seen a Microsoft moving that fast. Scott Guthrie introduced a bunch of new features on his blog yesterday. Today, I’m going to focus only on the new capability to monitor an endpoint. Available for your Cloud Services, Websites, Mobile Services and Virtual Machines, you’ll able to understand how fast (or slow) are your services for your customers around the world.

Beware that the feature works only in Reserved Mode. So if you want to track your Websites or Mobile Services do not forget to switch them to Reserved Mode in the SCALE panel.


You can add up to two endpoints to monitor for each service and each endpoint can be monitored from 3 different locations from the following list.

  • Chicago, IL, USA
  • San Antonio, TX, USA
  • San Jose, CA, USA
  • Ashburn, VA, USA
  • Dublin, Ireland
  • Amsterdam, Netherland
  • Hong Kong
  • Singapore

Each location for each endpoint will bring you two more metrics to monitor in the MONITOR panel:
Select Metrics
I don’t have enough information on my own Virtual Machines so I’m using the picture posted by Scott Guthrie on his blog:
Result Monitoring

Windows Azure outage on February 22, 2013

Azure SSL Outage

What a nice day in San Francisco after a week in Redmond, WA at the Microsoft headquarter for the Microsoft MVP Summit 2013.
On Friday, February 22, 2013 at 12:44 PM PST, the datacenters of the giant cloud service experienced a worldwide outage impacting the HTTPS traffic of the Storage service.

Azure Outage

1:30 PM PST, Microsoft identifies the issues. It comes from an expired SSL certificate. It seems Microsoft did not learn enough about the outage that happened during the leap day in 2012. Learn more about the service disruption of February 29th 2012.

Azure Outage

1:45 PM PST, Access Control, Service Bus, and the WebSites services are also impacted by the SSL certificate expiration.

Azure Outage

2:15 PM PST, Microsoft start patching their testing environment.


3:45 PM PST, Microsoft start patching their production environment. It will take few more hours before a full recovery. The storage I use for my application Earthquakes was back online at around 9 PM PST. No one is 100% safe from this kind of problem, but this is the second outage due to a certificate. Let see if Microsoft will publish something to explain the details of the problem like they do every time something goes wrong.


Windows Azure Service Dashboard.

I updated my application Earthquakes for Windows Phone 8 with a back-end using Windows Azure and Mobiles Services. I hope I did not make this outage happened 😉
I’ll publish soon an update for both Windows Phone and Windows 8 to support the new features provided by the Azure back-end.

Windows Azure Mobile Services – Update with REST APIs

Windows Azure Mobile Services

After the introduction to Windows Azure Mobile Services, I hope you had the chance to try this service. Di you know you can try Windows Azure for free for 90 days?

Today I would like to add a very short code snippet to help you updating an item in your Mobile Service. We have to use the HTTP method PATCH, send the id of the item to update and send the new item in the body of your request (serialized as a JSON message). You can use the following method in the class I gave to you in my introduction to Windows Azure Mobile Services.

public void Update<T>(string tableName, int idToUpdate, T item)
    where T : class
    Uri address = new Uri(string.Format("https://{0}{1}/{2}", ServiceName, tableName, idToUpdate));

    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(address);

    request.Method = "PATCH";
    request.Headers = new WebHeaderCollection
                                {"X-ZUMO-APPLICATION", ApplicationId},
                                {"X-ZUMO-MASTER", MasterKey},

    string serialization = item.Serialize();
    byte[] byteData = Encoding.UTF8.GetBytes(serialization);
    request.ContentLength = byteData.Length;

    using (Stream postStream = request.GetRequestStream())
        postStream.Write(byteData, 0, byteData.Length);

    HttpWebResponse response = (HttpWebResponse)request.GetResponse();

Introduction to Windows Azure Mobile Services


Today I would like to write about one of the feature on Windows Azure that was created by the team of Scott Guthrie. This new service, still tagged as a preview in the Azure management console, allows you to make easier your developments for Windows Phone, Windows 8 and even iPhone and Android devices with:

  • Structured storage. You can send and retrieve structured data between your client device and Azure using JSON messages or with the Windows Azure Mobile Services SDK. The backend of this storage is a SQL Server database but you don’t have to take care of it. Windows Store C#, Windows Phone 8, iOS.
  • User authentication. You will be able using a very simple line of code to get your mobile users to authenticate using for example their Microsoft Account or Facebook to access some restricted data or just to be identify by your system. Windows Store C#, Windows Phone 8, iOS.
  • Push notifications. Send a push notification to display a toast or change the tile on the client device has never been easier. With one line of JavaScript embedded on Azure, you can send push notification to all of your users. Windows Store C#, Windows Phone 8, iOS.

Microsoft did an amazing job by creating a lot of content to help developers creating applications using Windows Azure and I’ve linked, for each feature mentioned above, the corresponding tutorial for Windows 8 and Windows Phone 8 apps or even iOS.

Ok, now that we have the big picture of what is Windows Azure Mobile Services, let’s code a little bit. For one of my project I’m working on, I needed to connect Mobile Services, not from a mobile device but from a Worker Role also hosted on Azure. The main problem is that the Mobile Service SDK is not working for other projects than Windows 8, Windows Phone 8 (in the .NET world). Remember what I said about the Structured storage? You can exchange data using JSON messages. So I’ll use the REST APIs to communicate with my backend.

Continue reading