Wednesday, February 03, 2010
This might come as a surprise to some folks, but in Windows Azure you are billed when you deploy, not when you run. That means we don't care about CPU hours - we care about deployed hours. Your meter starts the second you deploy, irrespective of the state of the application. This means that even if you 'Suspend' your service so it is not reachable (and consumes no CPU), the meter is still running.
Visually, here is the meter still running:
Here is when the meter is stopped:
Right now, there is a 'free' offering of Windows Azure that offers a limited # of hours per month. If you are using MSDN benefits for Windows Azure, there is another offering that offers some bucket of 'free' hours. Any overage and you start to pay.
Now, if you are like me and have a fair number of hosted services squirreled around, you might forget to go to the portal and delete the deployments when you are done. Or, you might simply wish to automate the removal of your deployments at the end of day. There are lots of reasons to remove your deployments, but the primary one is to turn the meter off. Given that re-deploying your services is very simple (and can also be automated), this is not a huge issue to remove the deployment when you are done.
Automatic Service Removal
For those folks that wish an automated solution, it turns out that this is amazingly simple when using the Service Management API and the Azure cmdlets. Here is the complete, deployment-nuking script:
$cert = Get-Item cert:\CurrentUser\My\<cert thumbprint>
$sub = 'CCCEA07B. your sub ID'
$services = Get-HostedServices -Certificate $cert -SubscriptionId $sub
$services | Get-Deployment -Slot Production | Set-DeploymentStatus 'Suspended' | Get-OperationStatus -WaitToComplete
$services | Get-Deployment -Slot Staging | Set-DeploymentStatus 'Suspended' | Get-OperationStatus -WaitToComplete
$services | Get-Deployment -Slot Production | Remove-Deployment
$services | Get-Deployment -Slot Staging | Remove-Deployment
That's it - just 6 lines of Powershell. BE CAREFUL. This script will iterate through all the services in your subscription ID, stop any deployed service, and then remove it. After this runs, every hosted service will be gone and the billing meter has stopped (for hosted services anyway).
Monday, January 25, 2010
A few customers have asked how they can use tools like wazt, Windows Azure MMC, the Azure Cmdlets, etc. when they are behind proxies at work that require basic authentication. The tools themselves don't directly support this type of proxy. What we are doing is simply relying on the fact that the underlying HttpRequest object will pick up your IE's default proxy configuration. Most of the time, this just works.
However, if you are in an environment where you are prompted for your username and password, you might be on a basic auth proxy and the tools might not work. To work around this, you can actually implement a very simple proxy handler yourself and inject it into the application.
Here is one that I wrote to support wazt. To use this, add the following to your app.config and drop the output assembly from this project into your execution directory. Note, this would work with any tool in .NET that uses HttpWebRequest under the covers (like csmanage for instance).
<!-- basic auth proxy section declaration area-->
<!-- proxyHostAddress="Auto" : use Internet explorer configuration for name of the proxy -->
<configSections>
<sectionGroup name="proxyGroup">
<section name="basicProxy"
type="Proxy.Configuration.CustomProxySection, Proxy" />
</sectionGroup>
</configSections>
<system.net>
<defaultProxy enabled="true" useDefaultCredentials="false">
<module type="Proxy.CustomProxy, Proxy"/>
</defaultProxy>
</system.net>
<proxyGroup>
<basicProxy proxyHostAddress="Auto" proxyUserName="MyName" proxyUserPassword="MyPassword" />
</proxyGroup>
Download the source here.
I love elegant software. I knew about CloudXplorer from Clumsy Leaf for some time, but I hadn't used it for awhile because the Windows Azure MMC and MyAzureStorage.com have been all I need for storage for awhile. Also, I have a private tool that I wrote awhile back to generate Shared Access signatures for files I want to share.
I decided to check out the progress on this tool and noticed in the change log that support for Shared Access signatures is now included. Nice! So far, this is the only tool* that I have seen handle Shared Access signatures in such an elegant and complete manner. Nicely done!
Definitely a recommended tool to keep on your shortlist.
*My tool is complete, but not nearly as elegant.
Monday, January 11, 2010
Some time back, I put in a request to LINQPad's feature request page to support SQL Azure. I love using LINQPad for basically all my quick demo programs and prototypes. Since all I work with these days is the Windows Azure platform, it was killing me to have to go to SSMS to do anything with SQL Azure.
Well, my request was granted! Today, you can use the beta version of LINQPad against SQL Azure and get the full LINQ experience. Behold:
In this case, I am querying the firewall rules on my database using LINQ. Hot damn. Nice work Joe! If you pay a few bucks, you get the intellisense version of the tool too, which is well worth it. This tool has completely replaced SnippetCompiler for me and continues to get better and better. Now, if Joe would add F# support.
LINQPad Beta
Monday, November 23, 2009
For those of you that made PDC, this will serve as a reminder and for those of you that missed PDC this year (too bad!), this will serve as a guide to some great content.
PDC Sessions for the Windows Azure Platform
Getting Started
Windows Azure
Codename "Dallas"
SQL Azure
Identity
Customer & Partner Showcases
Channel 9 Learning Centers
Coinciding with PDC, we have released the first wave of learning content on Channel 9. The new Ch9 learning centers features content for both the Windows Azure Platform, as well as a course specifically designed for the Identity Developer. The content on both these sites will be continued to be developed by the team over the coming weeks and months. Watch out for updates and additions.
Downloadable Training Kits
To complement the learning centers on Ch9, we still continue to maintain the training kits on the Microsoft download center, which allows you to download and consume the content offline. You can download the Windows Azure Platform training kit here, and the Identity training kit here. The next update is planned for mid-December.
Monday, October 26, 2009
As I write this, I am sitting on a plane headed back to the US from a wonderful visit over to our UK office. While there, I got to meet a number of customers working with Windows Azure. It was clear from the interaction that these folks were looking for a way to simplify how to manage their deployments and build it into an automated process.
With the release of the Service Management API, this is now possible. As of today, you can download some Powershell cmdlets that wrap this API and make managing your Windows Azure applications simple from script. With these cmdlets, you can script your deploys, upgrades, and scaling operations very easily.

The cmdlets mirror the API quite closely, but since it is Powershell, we support piping which cuts down quite a bit on the things you need to type. As an example, here is how we can take an existing deployment, stop it, remove it, create a new deployment, and start it:
Get-HostedService $servicename -Certificate $cert -SubscriptionId $sub |
Get-Deployment -Slot Production |
Set-DeploymentStatus 'Suspended' |
Get-OperationStatus -WaitToComplete |
Get-HostedService $servicename -Certificate $cert -SubscriptionId $sub |
Get-Deployment -Slot Production |
Remove-Deployment |
Get-OperationStatus -WaitToComplete
Get-HostedService $servicename -Certificate $cert -SubscriptionId $sub |
New-Deployment Production $package $config -Label 'v.Next' |
Get-OperationStatus -WaitToComplete
Get-HostedService $servicename -Certificate $cert -SubscriptionId $sub |
Get-Deployment -Slot Production |
Set-DeploymentStatus 'Running' |
Get-OperationStatus -WaitToComplete
Notice that in each case, we are first getting our service by passing in the certificate and our subscription ID. Again, since this is Powershell, we can get the certificate quite easily:
$cert = Get-Item cert:\CurrentUser\My\D6BE55AC428FAC6CDEBAFF432BDC0780F1BD00CF You will find your Subscription ID on the portal under the 'Account' tab. Note that we are breaking up the steps by using the Get-OperationStatus cmdlet and having it block until it completes. This is because the Service Management API is an asynchronous model.
Similarly, here is a script that will upgrade a single role or the entire deployment depending on the arguments passed to it:
$label = 'nolabel'
$role = ''
if ($args.Length -eq 2)
{
$role = $args[0]
$label = $args[1]
}
if ($args.Length -eq 1)
{
$label = $args[0]
}
if ($role -ne '')
{
Get-HostedService $servicename -Certificate $cert -SubscriptionId $sub |
Get-Deployment -Slot Production |
Set-Deployment -mode Auto -roleName $role -package $package -label $label |
Get-OperationStatus -WaitToComplete
}
else
{
Get-HostedService $servicename -Certificate $cert -SubscriptionId $sub |
Get-Deployment -Slot Production |
Set-Deployment -mode Auto -package $package -label $label |
Get-OperationStatus -WaitToComplete
}
Download the cmdlets from Code Gallery and leave me some feedback if you like them or if they are not working for you.
Tuesday, October 06, 2009
Things are getting crazy here at Microsoft getting ready for PDC. I haven't had much time to blog or tweet for that matter. However, I am taking a break from the grind to announce something I am really excited about - a sample TableBrowser service we are hosting for developers at MyAzureStorage.com.
We built this service using ASP.NET MVC on a rich AJAX interface. The goals of this service were to provide developers to an easy way to create, query, and manage their Windows Azure tables. What better way to host this than on a scalable compute platform like Windows Azure?
Create and Delete Tables
If you need to create or manage your tables, you get a nice big list of the ones you have.
Create, Edit, and Clone your Entities
I love being able to edit my table data on the fly. Since we can clone the entity, it makes it trivial to copy large entities around and just apply updates.
Query Entities
Of course, no browser application would be complete without being able to query your data as well. Since the ADO.NET Data Services syntax can be a little unfamiliar at first, we decided to go for a more natural syntax route. Using simple predicates long with OR, AND, and NOT operations, you can easily test your queries.
Display Data
Lastly, we have tried to make showing data in Windows Azure as convenient as possible. Since data is not necessarily rectangular in nature in Windows Azure tables, we have given you some options: First, you can choose the attributes to display in columns by partition. Next, you expand the individual entity to show each attribute.
Please note: during login you will need to supply your storage account name and key. We do not store this key. It is kept in an encrypted cookie and passed back and forth on each request. Furthermore, we have SSL enabled to protect the channel.
The service is open for business right now and will run at least until PDC (and hopefully longer). Enjoy and let me know through the blog any feedback you have or issues you run into.
Friday, September 18, 2009
Windows Azure has been in CTP since PDC 08 in October of last year. Since that time, we have had a fairly simple, yet powerful concept for how to upgrade your application. Essentially, we have two environments: staging and production.
The difference between these two environments is only in the URI that points to any web exposed services. In staging, we give you an opaque GUID-like URI (e.g. <guidvalue>.cloudapp.net) that is hard to publically discover and in production, we give you the URI that you chose when you created the hosted service (e.g. <yourservice>.cloudapp.net).
VIP Swaps, Deploys, and Upgrades
When you wanted to upgrade your service, you needed to deploy the updated service package containing all your roles into one of the environments. Typically, this was in the staging environment. Whenever you were ready, you would then click the big button in the middle to swap environments. This re-programmed the load balancers and suddenly staging was production and vice versa. If anything went wrong in your upgrade, you could hit the button again and you were back to the original deployment in seconds. We called this model a "VIP Swap" and it is easy to understand and very powerful.
We heard from some customers that they wanted more flexibility to upgrade an individual role without redeploying the entire service. Typically, this can be because there might be some state or caching going on in one of the other roles that a VIP swap would cause to be lost.
The good news is that now you can upgrade individual roles (or even the whole service) using the in place upgrade. When you click the new 'Upgrade' button on the portal, you will see a screen very similar to the 'Deploy' screen that you would be used to from before, but this time you have two new options.
Upgrade Domains
The first new option allow you to choose if you want the upgrade to be 'Automatic' or 'Manual' across the upgrade domains. To understand this option, you would probably want to understand what an 'Upgrade Domain' is all about. You can think of upgrade domains as vertical slices of your application, crossing roles. So, if I had a service with a single web role using 10 instances with 2 worker roles, each with 4 instances, then with 2 upgrade domains, I would have a 5 web role instance, and 2 + 2 worker roles instances in each upgrade domain. Illustrated:
If I choose 'Automatic', it simply means that each upgrade domain will be sequentially be brought down and upgraded in turn. If I choose 'Manual', then I need to click another button between each upgrade domain update in order to proceed.
Note: in the CTP today, 2 upgrade domains are automatically defined and set. In the future, you will be able to specify how many upgrade domains you would like to have.
Role Upgrades
Next, we have a radio button that specifies if you want to update the whole service, or a specific role with in the service. Most folks will likely use the role specific update.
It is important to note that these upgrades are for the services where the topology has not changed. That is, you cannot update the Service Definition (e.g. adding, removing roles or configuration options). If you want to change the topology, you would need to use the more familiar VIP swap model.
Once you click Deploy, the selected role will be upgraded according to the upgrade mode you specified.
More information about in-place upgrades and update domains can be found here. Lastly, you can of course eschew the portal and perform all of these actions using the new Service Management API. Happy upgrading!
Wednesday, September 02, 2009
I am on vacation right now, but I read this over at Steve's blog and I just had to make sure everyone knows about it. Right now, when you register at Microsoft Connect for Windows Azure, you will get an instant token. No more 1 or 2 days wait!
Register for Windows Azure
Thursday, August 27, 2009
There has been a bit of interest in an application called 'myTODO' that we built for the World Partner Conference (WPC) event back in July. It is a simple, yet useful application. The application allows you to create and share lists very easily. It integrates with Twitter, so if you decide to share your lists, it will tweet them and their updates automatically. You can also subscribe to lists using standard RSS if Twitter isn't your thing.
The funny thing is that we only built this app because we wanted something more interesting than the standard "Hello World" application. The entire purpose of the app was to show how easily you can deploy an application (in just mins) on Windows Azure.
You can learn more about this application in 3 ways:
- Get the deployment package and deploy this yourself using our demo script from the Windows Azure Platform Training Kit. You will find it in the Demos section and called "Deploying Windows Azure Services".
- Watch me show how the app works and how to deploy it by watching my screencast.
- Download the source code and see how we built the rich dynamic UI and how we modeled the data using tables.