Monday, August 30, 2010

Presenting A Night Of Azure! RockNUG Sept. 8

On Wednesday, September 8, I’ll be taking over both the n00b presentation and the Featured presentation at the Rockville .NET User Group in Rockville, MD. I’ll be filling your heads with lots and lots of Azure, Microsoft’s most-excellent cloud computing platform!

If you’re new to Azure, the n00b session is the place to be! We’ll have our very first Azure application up and running in a few minutes, and we’ll learn about the basic moving parts.

For the Feature Presentation, we’ll build on our basic application, mixing in features from the three different Azure “portals”:

  • Windows Azure – this deals with the virtual machines and highly-scalable storage
  • SQL Azure – this is SQL Server, cloud-style!
  • AppFabric – this provides connectivity and access control

For those who would like to follow along: We’ll be taking things pretty slow in the n00b session. If you’d like to try building your first Azure app along with me, you’ll need to a few things first – see details here. A quick summary to get up and running:

  • Windows Vista, 2008, or Windows 7 (sorry, XP folks…)
  • Visual Studio 2010 Web Developer Express or any version from your MSDN subscription (Professional, Ultimate, etc.)
  • SQL Server 2005 Express or above
  • Azure SDK 1.2 + Visual Studio Tools

Friday, August 20, 2010

Azure Tip of the Day: Determine if running in Dev Fabric or Azure Fabric

One potential goal, when writing a new Azure application, is to support running in both Azure-hosted and non-Azure environments. The SDK gives us an easy way to check this:
            if (RoleEnvironment.IsAvailable)
            {
                // Azure-specific actions
            }

With this check, you could, say, build a class library that has specific behaviors depending on the environment in which it’s running.

Now, let’s assume the Azure environment is available, and you need to take a specific action depending on whether you’re running in the Dev Fabric vs. the Azure Fabric. Unfortunately, there’s no specific method or property in RoleEnvironment that helps us out.

This brings me to today’s tip: Determining whether an app is running in Dev Fabric or Azure Fabric.


The Deployment ID

While there’s no direct call such as RoleEnvironment.InDevFabric, there’s a neat trick I use, making it trivial to figure out. A disclaimer first: This trick is dependent on the specific way the Dev Fabric and Azure Fabric generate their Deployment IDs. This could possibly change with a future SDK update.


Whenever you deploy an Azure application, the deployment gets a unique Deployment ID. This value is available in:
RoleEnvironment.DeploymentId.

As it turns out, the deployment ID has two different formats, depending on runtime environment:


  • Dev Fabric: The deployment ID takes the form of  deployment(n), where n is sequentially incremented with each Dev Fabric deployment.
  • Azure Fabric: The deployment ID is a Guid.
With this little detail, you can now write a very simple method to determine whether you’re in Dev Fabric or Azure Fabric:
        private bool IsRunningInDevFabric()
        {
            // easiest check: try translate deployment ID into guid
            Guid guidId;
            if (Guid.TryParse(RoleEnvironment.DeploymentId, out guidId))
                return false;   // valid guid? We're in Azure Fabric
            return true;        // can't parse into guid? We're in Dev Fabric
        }

 Taking this one step further, I wrote a small asp.net demo app that prints out the deployment ID, along with the current instance ID. For example, here’s the output when running locally in my Dev Fabric:


BrowserCap-DevFabric

 Here’s the same app, published to, and running in, the Azure Fabric:

BrowserCap-AzureFabric



Try it yourself

I uploaded my demo code so you can try it out yourself. You’ll need to change the diagnostic storage account information in the asp.net role configuration, prior to deploying it to Azure.

Sunday, August 15, 2010

Azure Tip of the Day: Separate Diagnostic Storage Account

Recently I was helping someone debug a bizarre Azure Table storage issue. For some reason, the role’s state went into a busy/running loop as soon as the OnStart() event handler attempted to set up some Azure tables. To make matters worse, once the startup code attempted to connect to the storage account and create a table, we no longer received Trace log output. This doesn’t help much when the only log message is “In OnStart()…”.

To get our diagnostics back, we created a separate storage account exclusively for diagnostics. Once we did this, we had an uninterrupted flow of trace statements, even though the table-access code was still having issues with the table storage account.

This leads me to my tip of the day: Set up a separate storage account for diagnostics.

Aside from isolating storage connectivity issues, there are other benefits to having a separate storage account for diagnostics:

  • You can have a separate access key for diagnostics, granting this to a broader audience. For instance, you could give out the access key for people to use inside a diagnostics tool such as Cerabrata’s Diagnostics Manager, without having to give out the access key to your production data storage account.
  • Storage accounts have a transactional limit of approx. 500 transactions / second. Beyond that, and the Azure fabric throttles your access. If your app is writing even a single trace statement to diagnostic tables for every real data transaction, you’re doubling your transaction rate and you could experience throttling much sooner than expected.
  • An additional storage account does not necessarily equate to additional cost. You’re simply billed for the storage you consume. If the total amount of storage across two accounts remains the same as with a single account, your cost will remain the same.

Setting things up

First head to the Azure portal, and set up two accounts. I advise putting them in the same affinity group, alongside your Azure services.

twostorageaccts

Each account will have its own access keys. Simply configure both in your role.

connectionstrings

Now, all that’s left is specifying the diagnostic storage account for the DiagnosticMonitor, and the data storage account for “real” data access.  For instance, this example enables the DiagnosticsMonitor using MyAppDiagnosticStorage, while the table service uses MyAppDataStorage:

        public override bool OnStart()
        {

            DiagnosticMonitor.Start("MyAppDiagnosticStorage");
            Trace.TraceInformation("Writing to diagnostic storage");

            var dataStorageAccount = CloudStorageAccount
                .FromConfigurationSetting("MyAppDataStorage");
            var tableClient = dataStorageAccount.CreateCloudTableClient();
            tableClient.CreateTableIfNotExist("MyTable");

            RoleEnvironment.Changing += RoleEnvironmentChanging;

            return base.OnStart();
        }


That’s it!

Tuesday, July 20, 2010

Come learn Azure in DC, July 28!

I’ll be heading out to the Washington DC DotNet User Group July 28 to present an introduction to Azure. I’ll give a quick overview of the platform, then dive into code samples showing how to build and deploy an Azure application to the cloud. I’ll also show SQL Azure, the cloud-equivalent of SQL Server.

The meeting starts at 6:30. If you plan on attending, please register here so the group can plan accordingly.

For more information about DCDotNetUG, including directions, please visit their homepage at www.dcdnug.org. Directions are on their Contact Us page.

Friday, July 2, 2010

Words speak louder than reactions

I’ve heard the old expression so many times: Actions speak louder than words. That’s true, especially when the words sound like “I’m going to make the world a better place!” Or maybe , “Wait until you see this new program I’m going to build for you!” Truly, actions speak much, much louder than these words, especially if there’s no follow-through and the words simply turn into empty promises.

But… let’s look at another type of action: the knee-jerk reaction. How often have we taken a vengeful, spiteful, or anger-induced action before having a discussion about it? How often are those reactions a result of our emotions running amok before we have an opportunity to think about the ramifications of our reactions? If I do a bit of reflection, I can easily identify more than one occasion where I would have likely been better off talking something through than taking the action (the reaction) that I ultimately took.

Today’s Knee-Jerk

I have a lake house that I rent out, in Lake Anna, Virginia. We take pride in our property, and most of our guests return each year, knowing we strive to provide the best vacation environment possible. Today, our cleaning company emailed me, letting me know that I’ve been fired as a customer, simply because I emailed a punchlist of not-so-favorable feedback from last week’s renters, and suggested that her cleaning crew absorb the cost of the cleaning.

I certainly expected an email exchange, or possibly a phone call, with a settlement negotiation, perhaps. Maybe we split the cost? Maybe we educate this new crew on how to live up to expectations in the future? Instead, I received a terse email, stating that this situation is beyond acceptable, and that the cleaning company shouldn’t be financially responsible for such actions. So… we quit.

Do-the-right-thing attempt

Let’s face it: the damage was done, and it was unlikely that I’d be able to preserve a working relationship with this financially-struggling cleaning company. However, I took the high road and placed a well-crafted phone call to the business owner. I expressed the idea of open communication, and how, as a service provider, they had every right to call and discuss the cleaning terms with me, and even negotiate a compromise.

Alas, I was correct in my assumption: There was no way they were ever going to provide cleaning services to me again. They are running on extremely thin margins, they said. And since they already paid the errant cleaning crew, the company itself took the hit (less than $125), which now put them at financial risk. The bitterness and anger flowed through the phone line (it was on Skype, but you get the picture), and there was to be no compromise, no resolution, no happy-path.

Knee-Jerks in the software development world

Most of my readers are in the software development field, and probably don’t care too much about my cleaning crew woes. However: There’s a lesson in here for all of us: Communication is King, and should trump knee-jerk and emotional decisions!

Knee-jerk reactions are easy: Just sit back in your chair, fume for a while, and then act out your emotions with glee. It’s much harder, in a fit of emotion, to engage rational thought and communicate directly with the person or entity causing you stress and grief.

Think about the net result you’re looking for: Do you really want to pick a fight? Do you really want to sever ties and damage a potentially-lucrative future business relationship? Being in the software field, I am amazed at just how many people I keep running into over the years, from previous employment. As large as the industry is, sometimes that circle seems pretty small. I certainly want to keep these relationships alive and healthy!

Words over reaction

Will communication always lead to a satisfactory settlement? No way! However, I’m pretty sure that knee-jerk reactions will almost always lead to someone getting angry, hurt, disparaged, frustrated, and unwilling to work in a professional manner in the future.

Is a polite, professional phone call or email easy? Not always, and certainly not as easy as a knee-jerk email filled with venom and animosity! This is no reason to avoid doing the right thing, and exercising diplomacy wherever possible.

Today, I lost my cleaning crew. And this loss will have untold impact on their bottom line, as they can no longer showcase my business on their website or even use me as a reference for future work. Was the reaction really worth it?

As you run into your next on-the-job challenge, whether it’s with a teammate, your boss, your employee, or your customer: I urge you to consider words over reaction.

Related links

Our lake house website is www.LakeAnnaDream.com.

Tuesday, June 29, 2010

Azure Bootcamp Prerequisites

Updated 7/5/2010 with download link to SQL Server 2008 R2 Management Studio Express.

For those attending the Virginia Beach Azure Bootcamp, July 7 is only a week away! Kevin Griffin and I are going to hit the ground running, so you’ll want to spend some time getting all needed software installed. Here’s the list of what you’ll need, along with download links for each product.

For more information about the bootcamp, please leave a comment.

Kevin and I are both available via twitter. Kevin is @1kevgriff. I’m @dmakogon.

Visual Studio

First, there’s the development environment. You’ll need one of the following:

  • Visual Web Developer 2010 Express. This is a free edition that will let you build all of the samples we’ll be working with.
  • Visual Studio 2010. If you have an MSDN subscription, you can download and install any version of VS2010 from MSDN.

Download Visual Web Developer 2010 Express here.

Download Visual Studio 2010 from MSDN.

Azure SDK + Tools

You’ll need the latest SDK + Tools, version 1.2, released in June 2010. This includes Visual Studio extensions for the various cloud projects.

Download the Azure SDK, version 1.2  here.

AppFabric SDK

The AppFabric SDK version 1.0 was released April, 2010. The AppFabric SDK lets you build applications that take advantage of the Service Bus and Access Control services of Azure AppFabric.

Download the AppFabric SDK, version 1.0  here.

Table / Blob Storage Viewer

Visual Studio 2010, in conjunction with the Azure Tools v1.2, provides a built-in table storage viewer. However, this is a read-only set of tools. To modify storage data, you’ll need a more advanced tool such as the freely-available Azure Storage Explorer or the commercial Cerebrata Cloud Storage Studio.

Download the Azure Storage Explorer here.

Download the Cerebrata Cloud Storage Studio trial here.

Azure Training Kit

You’ll need the Azure Platform Training Kit, June 2010 update.

Download the training kit, June 2010  here.

Folding @Home

Folding @Home is a distributed computing project. You’ll need both the Visual Studio project and the Folding@home client application.

Download the Visual Studio 2010 project here.

Download the Folding@home console application here.

SQL Server Management Studio 2008 R2

SSMS is the de facto SQL-editing tool. With SQL Azure, you’ll need the new Management Studio Express for SQL 2008 R2, as SSMS Express 2008 R2 supports SQL Azure script generation.

Download SSMS 2008 R2 here.

Friday, June 25, 2010

SQL Azure 50GB is Live!

During Tech Ed this year, we learned about the new 50GB database limit for SQL Azure, up from 10GB. The go-live date was set for June 28th. Surprise – it’s live today!

How do I choose this new database size?

When creating your new database, select Business edition, and look at the size dropdown:

50GBdropdown

Notice that there are now five sizes to choose from. This sets the size limit, which also directly impacts monthly cost, as each 10GB increment runs $99.99 per month:

Size: Business Edition

Monthly Rate

10GB

$99.99

20GB

$199.98

30GB

$299.97

40GB

$399.96

50GB

$499.95

But wait… there’s more! Now take a look at the Web edition sizes:
5GBdropdown

Web Edition pricing only has two tiers:

Size: Web Edition

Monthly Rate

1GB

$9.99

5GB

$49.95

Size and Price

The really nice thing about all these additional sizes: this sets your spending cap as well as size cap. For example: if you set your Business Edition database to 10GB, your monthly charge will never exceed $99.99 per month.

Let’s make things more interesting. Let’s say you set up a 20GB Business Edition database. You are not simply charged $199.98 per month. Rather, your monthly cost is amortized daily, with the daily rate based on the maximum size the database reaches on a given day.

For this 5GB database, let’s say you stay under 1GB for the first 5 days. Those days will accrue at the 1GB rate. Then one day you go over 1GB. At that point, you start accruing at the 5GB rate. If your database ever drops back under 1GB, your daily accrual rate drops back to the 1GB rate.

The same rate pattern applies to the Business edition, where the billing tiers are 10, 20, 30, 40, and 50GB.

Changing Sizes

Ok, so you set up your new database. Let’s say it’s Web Edition, 1GB. And you now realize you need the ability to grow your database to 5GB. No problem: just connect to the Master database and issue an ALTER DATABASE command:

ALTER DATABASE MyDatabase MODIFY (EDITION='WEB', MAXSIZE=5GB)

Until your actual database size exceeds 1GB, this change will not cause you to incur additional costs; you’ll still be billed at the 1GB rate.

More information

The SQL Azure blog has details about the new sizes, as well as all T-SQL for creating and altering databases, here.

Today’s launch announcement is here.