Scott Hanselman

Managing the Cloud from the Command Line

June 20, '12 Comments [16] Posted in Azure | Open Source
Sponsored By

I blogged about the Windows Azure cloud a few weeks ago. I'm digging the new stuff and trying different scenarios on Macs, PCs and Linux (I prefer Ubuntu). As a long time PowerShell and Command Line fan I'm always looking for ways to do stuff "in text mode" as well as scripting site creations and deployments.

Turns out there are a mess of ways to access Azure from the command line - more than even I thought. There's a JSON-based Web API that these tools end up talking to. You could certainly call that API directly if you wanted, but the command line tools are damn fun.

You can install the Mac Azure SDK installer to get the tools and more on a Mac, or if you install node.js on Windows or Mac or Linux you can use the Node Package Manager (npm) to install Azure tools like this:

npm install azure-cli --global

You can also use apt-get or other repository commands. After this, you can just run "azure" which gives you these commands that you link together in a very intuitive way, "azure topic(noun)verb option" so "azure site list" or "azure vm disk create" and the like.

Azure command line format

There's even ASCII art, and who doesn't like that. ;)

Seriously, though, it's slick. Here's a sample interaction I did just now. I trimmed some boring stuff but this is starting from a fresh machine with no tools and ending with me interacting with my Windows Azure account.

scott@hanselmac:~$ npm install azure-cli
npm http GET
...bunch of GETS...
scott@hanselmac:~$ azure
info: _ _____ _ ___ ___
info: /_\ |_ / | | | _ \ __|
info: _ ___/ _ \__/ /| |_| | / _|___ _ _
info: (___ /_/ \_\/___|\___/|_|_\___| _____)
info: (_______ _ _) _ ______ _)_ _
info: (______________ _ ) (___ _ _)
info: Windows Azure: Microsoft's Cloud Platform
info: Tool version 0.6.0
...bunch of help stuff...

scott@hanselmac:~$ azure account download
info: Executing command account download
info: Launching browser to
help: Save the downloaded file, then execute the command
help: account import
info: account download command OK
scott@hanselmac:~$ cd ~
scott@hanselmac:~$ cd Downloads/
scott@hanselmac:~/Downloads$ ls
3-Month Free Trial.publishsettings
scott@hanselmac:~/Downloads$ azure account import 3-Month\ Free\ Trial.publishsettings
info: Executing command account import
info: Setting service endpoint to:
info: Setting service port to: 443
info: Found subscription: 3-Month Free Trial
info: Setting default subscription to: 3-Month Free Trial
warn: Remember to delete it now that it has been imported.
info: Account publish settings imported successfully
info: account import command OK
scott@hanselmac:~/Downloads$ azure site list
info: Executing command site list
+ Enumerating locations
+ Enumerating sites
data: Name State Host names
data: ----------------- ------- -------------------------------------------------------------
data: superawesome Running,
info: site list command OK
scott@hanselmac:~/Downloads$ azure site list --json
"AdminEnabled": "true",
"AvailabilityState": "Normal",
"EnabledHostNames": [
"HostNames": [
"State": "Running",
"UsageState": "Normal",
"WebSpace": "eastuswebspace"

Here's how I can create and start a VM from the command line. First I'll list the available images I can start with, then I create it. I wait for it to get ready, then it's started and ready to remote (RDP, SSH, etc) into.

scott@hanselmac:~$ azure vm image list
info: Executing command vm image list
+ Fetching VM images
data: Name Category OS
data: -------------------------------------------------------------------------- --------- -------
data: CANONICAL__Canonical-Ubuntu-12-04-amd64-server-20120528.1.3-en-us-30GB.vhd Canonical Linux
data: MSFT__Windows-Server-2012-RC-June2012-en-us-30GB.vhd Microsoft Windows
data: MSFT__Sql-Server-11EVAL-11.0.2215.0-05152012-en-us-30GB.vhd Microsoft Windows
data: MSFT__Win2K8R2SP1-120514-1520-141205-01-en-us-30GB.vhd Microsoft Windows
data: OpenLogic__OpenLogic-CentOS-62-20120531-en-us-30GB.vhd OpenLogic Linux
data: SUSE__openSUSE-12-1-20120603-en-us-30GB.vhd SUSE Linux
data: SUSE__SUSE-Linux-Enterprise-Server-11SP2-20120601-en-us-30GB.vhd SUSE Linux
info: vm image list command OK
scott@hanselmac:~$ azure vm create hanselvm MSFT__Windows-Server-2012-RC-June2012-en-us-30GB.vhd scott superpassword --location "West US"
info: Executing command vm create
+ Looking up image
+ Looking up cloud service
+ Creating cloud service
+ Retrieving storage accounts
+ Creating VM
info: vm create command OK
scott@hanselmac:~$ azure vm list
info: Executing command vm list
+ Fetching VMs
data: DNS Name VM Name Status
data: --------------------- -------- ------------
data: hanselvm Provisioning
info: vm list command OK

That's the command line tool for Mac, Linux, and optionally Windows (if you install node and run "npm install azure --global") and there's PowerShell commands for the Windows admin. It's also worth noting that you can check out all the code for these as they are all open source and up on github at The whole command line app is written in JavaScript, in fact.

Just as the command line version of the management tools has a very specific and comfortable noun/verb/options style, the cmdlets are very "PowerShelly" and will feel comfortable folks who are used to PowerShell. The documentation and tools are in a Preview mode and are under ongoing development, so you'll find some holes in the documentation.

The PowerShell commands all work together and data is passed between them. Here a new Azure VM configuration is created while the VM Name is pull from the list, then the a provisioning config object is passed into New-AzureVM.

C:\PS>New-AzureVMConfig -Name "MySUSEVM2" -InstanceSize ExtraSmall -ImageName (Get-AzureVMImage)[7].ImageName 
` | Add-AzureProvisioningConfig –Linux –LinuxUser $lxUser -Password $adminPassword
` | New-AzureVM

Next, I want to figure out how I can spin up a whole farm of websites from the command line, deploy an app to the new web farm, configure the farm for traffic, then load test it hard, all from the command line. Such fun!

Sponsor: I want to thank the folks at DevExpress for sponsoring this week's feed. Check out their DXperience tools, they are amazing. You can create web-based iPad apps with ASP.NET and Web Forms. I was personally genuinely impressed. Introducing DXperience 12.1 by DevExpress - The technology landscape is changing and new platforms are emerging. New tools by DevExpress deliver next-generation user experiences on the desktop, on the Web or across a broad array of Touch-enabled mobile devices.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

The Sad State of Diabetes Technology in 2012

June 17, '12 Comments [118] Posted in Diabetes
Sponsored By

animation1I've been diabetic for almost two decades. It's tiring, let me tell you. Here's a video of my routine when I change my insulin pump and continuous meter. I'm not looking for pity, sadness or suggestions for herbs and spices that might help me out. I'd just like a day off. Just a single day out of the last 7000 or the next, I'd like to have a single piece of pie and not chase my blood sugar for hours.

Every time I visit the doctor (I do every 3 months) and every time I talk to someone in industry (I do a few times a year) I'm told that there will be a breakthrough "in the next 5 years." I've been hearing that line - "it's coming soon" - for twenty.

I used to wait a minute for a finger stick test result. Now I wait 5 seconds but we still have blood sugar strips with +-20% accuracy. That means I can check my sugar via finger stick twice and get a number I'd take action on along with one I wouldn't. Blood sugar strip accuracy is appalling and a dirty little secret in the diabetes community.

I started with insulin that would reach its peak strength after about 4 hours. Today it takes about an hour. Awesome, but that's not fast enough when a meal can take me to the stratosphere in minutes.

We are hurting here and we can't all wait another five years. Diabetes is the leading cause of blindness, leading cause of kidney failure and leading cause of amputation.

I wrote the first Glucose Management system for the PalmPilot in 1998 called GlucoPilot and provided on the go in-depth analysis for the first time. The first thing that struck me was that the PalmPilot and the Blood Sugar Meter were the same size. Why did I need two devices with batteries, screens, buttons and a CPU? Why so many devices?

NewColorSmall_smallIn 2001 I went on a trip across the country with my wife, an insulin pump and 8 PDAs (personal digital assistants, the "iPhones" of the time) and tried to manage my diabetes using all the latest wireless technology. Here's what I had to say 11 years ago:

With Bluetooth coming, why couldn't my [PalmPilot] monitor my newly implanted smart-pump? GlucoPilot could generate charts and graphics from information transmitted wirelessly from the pump. For that matter, the pump, implanted in my abdomen, could constantly transmit information to Bluetooth-enabled devices that surround me. The pump might use my cell phone to call in its data into a central server when I'm not using the phone. If I wander near my home computer, the pump or Visor might take the opportunity to upload its data. During a visit to the doctor, Bluetooth's 30-meter range could provide the doctor with my minute-by-minute medical history as I sat in the waiting room.

Back in 1998 when I was writing and marketing GlucoPilot I was using a custom cable that connected directly from my PalmPilot to the glucose meter and downloaded my historical glucose data. Fast forward to 2012 and what new technologicals innovation do we have?

Yes, that's a custom cable to plug-in to my PDA. Yes, I'm a frustrated diabetic. This a 15 year old solution with no backing standards, no standard interchange format, no central cloud to store the data in. It's vendor lock-in on both sides.

Kudos to the Glooko guys for fighting the good fight and shame on the blood sugar meter manufacturers for making their job hard.


Fifteen years ago we talked about data standards and interoperability. I was even on a standards board for a while to try and pressure the industry to standardize on data interchange formats. I have personally written multiple blood sugar meter data importers from the very simple (CSV) to the very complex (binary packed and purposely obscured to prevent 3rd party data dumps) and I can tell you that the blood sugar meter manufacturers are not interested in making it easy to move our data around. This is a billion dollar industry.

Today I read an article about the iBGStar (a forgettable name) glucose meter that plugs directly into an iPhone 30 pin port. The article came up on Hacker News and one of the designers said this in a comment:

I'm one of the designers of the iBGStar and we considered Bluetooth. We actually have another FDA cleared product that uses Bluetooth, but cost, battery life, and a bunch of technical issues led us to favor the 30 pin.

iBGStar-IPhoneThis is hugely disappointing especially since Bluetooth 4.0 is said to offer battery life as long as 10 years on some products. Given all the new iPhones have Bluetooth 4.0 just waiting for devices to connect to, you'd think this is a perfect opportunity for a Bluetooth 4.0 glucose meter.

I appreciate the attempts and the word that is being done in the space, I truly do, but as an end user when I see products like this that are trying to push the envelope but fail with fundamental usability issues, I'm saddened. Most diabetics check their blood sugar 10 times a day or more. I can't keep this glucose meter attached to my phone. It'll fall off, get bent, mess up the 30 pin connector. It's simply not reasonable for a day to day use coming in and out of pockets.

A more reasonable mode of usage would mirror the FitBit. It's tiny, clips to my belt and automatically notices when I pass by my computer then uploads its data wirelessly. That's how wireless is supposed to work. And the battery lasts at least a week.

Twenty years and no significant moves. We are still wiring our devices together, translating from one format to another, all the while being hamstrung by the FDA and their processes. When we do start to get something working well, it's attacked and we're told that our insulin pumps can be hacked from a mile away and we can be killed in our sleep. This will no doubt slow progress and make the FDA even more paranoid when approving new technology.

I've just this week switched from a Medtronic Continuous Glucose Meter to a DexCom, which is another company. This new CGM gives me more accurate data with less lag time. However, I still have the same insulin pump. This means my meter and pump aren't integrated so I carry another device on my person. This is because while the Animas Vibe, a pump that integrates both the DexCom meter and an insulin pump as well as other features like being waterproof, is available EVERYWHERE but the US. It's in the FDA process. Maybe ready in 6 months? 18? Who knows. When it shows up, the technology will be years old while the iPhone is on generation 6. We've got 3D TVs to watch crappy movies on by my insulin pump's firmware hasn't changed in nearly a decade.

The article about the iBGStar is poorly researched and galling.  I appreciate what Hacker News commenter lloyd said with emphasis mine, calling out this inane line from the article.

"Could this be the beginning of mobile diabetes monitoring?"

As so many people above have stated, no, you moron. We've been monitoring blood sugar on the go for the past 30 years.

I've got Type 1 diabetes...and my current meter is smaller than the one shown here. I can plug it into my Mac via USB to download and visualize the data (& can control my insulin pump via bluetooth using the meter).

The only benefit with this particular iPhone-compatible meter would be enhanced, immediate visualization of results. Which might be easier to get, and might not, given the inconvenience of having to remove an iPhone case and plug in the meter. (Not to mention other issues - what if my iPhone's batteries are dead? Will it still work?)

Unfortunately, this product reminds me of 5 years ago, when someone would announce a new toaster, and the tech crowd wouldn't be impressed...unless it was a Bluetooth toaster. We're so focused on it being the hot new thing (it's compatible with iOS! Oooh!!) that we ignore the fact that there's nothing revolutionary being presented here.

The way I see it, this doesn't really change anything in terms of treatment. If it's a more accurate meter, great - sell based on that. Not on the bogus "we're taking blood glucose monitoring mobile" claims.

You may feel like technology is amazing and it's moving so very fast and it surely is. But as a diabetic who relies on technology to stay alive as along as I possibly can, it feels like nothing has changed in 20 years. Maybe something will happen in just 5 more.

Sponsor: I want to thank the folks at DevExpress for sponsoring this week's feed. Check out their DXperience tools, they are amazing. You can create web-based iPad apps with ASP.NET and Web Forms. I was personally genuinely impressed. Introducing DXperience 12.1 by DevExpress - The technology landscape is changing and new platforms are emerging. New tools by DevExpress deliver next-generation user experiences on the desktop, on the Web or across a broad array of Touch-enabled mobile devices.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Hanselminutes Podcast 323 (and more) - On Empathy with Leon Gersing the Ruby Buddha

June 16, '12 Comments [5] Posted in Podcast
Sponsored By

It's been a while since I updated the Podcast category of my blog. I never got around to making a script to do it for me and I started to feel like some weeks were just blog posts of lifeless podcast announcements. Regardless, my podcast(s) march on. I've even got plans for a third that will surprise you.

I did want to share, however, a few episodes lately that really seemed to resonate with people. If you haven't listened to one of our podcasts before or are looking for a good episode to jump in on for a long drive or airplane ride, then these are great places to start. I'm particularly happy with them.

First, as a reminder, Hanselminutes is a 30 minute "commute time" mostly podcast whose goal is is to NOT waste your time. I try to get right into the conversation with minimal "how's the weather" conversation. I've been doing the show consistently - weekly - with Telerik and Carl Franklin's support since January of 2006. That's over 300 episodes! 323, in fact, at last count. All are available in the archives and the ones marked with an asterisk (*) include a transcript which is useful for the hearing impaired or those learning English. We're currently catching up on transcripts with the goal being a consistent release schedule and a complete archive.

I also do a podcast with Rob Conery called This Developer's Life, although more sporadically as the work we put into the show is INSANE. DevExpress pays for the bandwidth and supports the show and we can't thank them enough.

You can tweet both DevExpress and Telerik and thank for supporting these two labors of love as without them, the shows would not exist.

This Developer's Life 2.0.8 - Learn

Recently Rob and I posted a new This Developer's Life episode called "Learn." We talk to two engineers and very different places in their careers with very different academic experiences. One a professional engineer and author with many years experience but a Liberal Arts education in a non-related topic and the other a 17 year old home schooled Microsoft intern who builds rockets in his spare time when he's not mastering parallel computing. Please do subscribe to This Developer's Life, add This Developer's Life to your iTunes or even give us a review. You can get the complete back catalog of 23 episodes. More are coming soon.

Hanselminutes 323 - Empathy with Leon Gersing

I spoke to Leon Gersing (@rubybuddha) on Hanselminutes a few days ago. We spoke about empathy and people. What causes one community to be empathetic and another not? What really drives us as creators? Is it money, tech or the potential connection we can have to other people? We also covered promiscuous pairing, kindness vs. empathy and the user connection. I really have warm feelings towards Leon and what he stands for and I really think this is a great episode you should check out. You can also find and subscribe to the complete archive for Hanselminutes on Feedburner as well as Hanselminutes on iTunes.

Hanselminutes 319 - The Making of How to be Black with Baratunde Thurston

Baratunde Thurston has extensive experience in being Black for more than 30 years. Baratunde was the Digital Director at The Onion until recently and is now striking out on his own with a new venture called Cultivated Wit. He keynoted SXSW this year and is currently on tour promoting his book "How To Be Black." He talked to me about how he used technology to turn his memoir into a New York Times bestseller. He's a comic, a writer, and a social media expert and gave me my own actual in-real-life "Black Card" that I use to impress the whitest of relatives. ;) 

Hanselminutes 317 - It IS Rocket Science with Holly Griffith

What? I thought this was a tech show! Fine, here's Rocket Scientist and former Space Shuttle Flight Controller Holly Griffith, now an International Space Station worker bee. Holly is an engineer who has worked in and around space and aerospace for her entire career. Holly and I talk space, engineering, fuel cells and I try desperately to keep up.

Hanselminutes 314 - More Relationship Hacks with Scott's Wife

Almost two years after our most popular show to date, my Wife Mo is back! How does one manage a mixed (geek/normal) marriage? Can Scott and Mo agree on the fundamental laws of physics? Check out part one also and yes, we are still working on the book. Sigh.

I hope you enjoy the shows!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Who is on your Life's Board of Directors?

June 13, '12 Comments [18] Posted in Musings
Sponsored By

UPDATE: Share this URL! and tell YOUR support network about this idea!

My good friend Luvvie, a humor blogger, recently tweeted this in response to some goodness in her life:

Luvvie and I have talked about this before and even assembled board of directors for ourselves, have suggested the idea to friends, acquaintances and even a few real-life famous people. My friend Adria Richards has "Team Adria" for example, and reaches out when life gets exciting and confusing.

The idea is of a board of directors is such a simple one but it's truly life changing when put to work.

Adria, myself and Luvvie

My wife and I talk a little about mission statements in the context of marriage in our (perpetually) upcoming book on Relationship Hacks. Here's a quote from our as-of-yet-unfinished book:

And so we sat down to develop a mission statement. Historically the idea of a mission statement has been associated with religious groups, guiding missionaries on their religious missions by giving them specific principles they can hold on to. In recent times most people are familiar with the concept of a mission statement in a corporate context.

Using the definition of "mission statement" from Wikipedia - the source of all geek wisdom until it's edited by someone else - and we'll replace the words company or organization with marriage. If you're not married, of course adjust the paragraph to your preference.

A formal, short, written statement of the purpose of a marriage. The mission statement should guide the actions of the marriage, spell out its overall goal, provide a sense of direction, and guide decision-making. It provides "the framework or context within which the marriage's strategies are formulated."

Take a moment and drink that in, as Scott likes to say. That seems like a totally reasonable thing to do doesn't it? I mean, you agonize about your vows for weeks, why not take an evening and write a mission statement? Why do so few people work for months to plan home purchases, months deciding where they live, what car to buy, but don't create guiding principles for the next 50 years of your life?

Companies have mission statements and a Board of Directors. Your life is pretty important. Why not create a Life Board of Directors to help you through it? Pick 2 to 5 of your friends. Not necessarily your closest friends, but friends that are close enough where you can really confide but not so close that they can't see the big picture. Email them one a month, once a quarter or "once a crisis." Ask them for advice, lean on them, trust them and help them as well.

Assemble "Team You" and use your team to brainstorm directions and implementations of big decisions like moving to New York, or changing your business's direction, starting a new venture, or getting fit. 

Use your personal Board of Directors as one of the compasses in your life. You've got family, friends, perhaps faith, hobbies, values, etc. Add your Team to this list of personal compasses. 

It might sound like a silly mind game, but that's common with many hacks. Hacks feel insignificant but can have huge effects. The trick is to remember that it is a hack - you're hacking yourself. The idea of life's board of directors is a relationship hack meant to remind you in difficult times that you can agree on something fundamental and you have a team to support you in your endeavors. Set a direction and head in that direction with the confidence you've got a supportive group behind you.

Go assemble your Life's Board today.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Simulating an iPhone or iPad browser for ASP.NET Mobile Web Development with WebMatrix 2 or Visual Studio 2012

June 11, '12 Comments [27] Posted in Apple | ASP.NET | Tools | WebMatrix
Sponsored By

I mentioned the Electric Plum Mobile Simulator as a nice way to check your site on an iPhone while using a Windows machine in my post called "Create a great mobile experience for your website today. Please."

Microsoft WebMatrix 2 RC is out this week and has a nice feature included - support for the Electric Plum Mobile Simulator for iPhone and iPad built right in. WebMatrix is Microsoft's lightweight editor for ASP.NET, PHP and node.js, as well the best way to install open source applications. It's a bit of a playground for the team. Features can be tried out in WebMatrix, and if they pop, we can move them into Visual Studio. I've been singing about Electric Plum for months, so I'm happy to see it in WebMatrix.

Here's how to use the iPhone simulator there, and how to add an iPhone Simulator to Visual Studio 2012 RC's list of browsers manually.

First, install WebMatrix 2 RC. You'll want this even if you're going to add Electric Plum to Visual Studio. From the Run menu, select Add new...

Adding iPhones to the WebMatrix run menu

From here, you'll go to the Browser Extension area where you can add not only iPhone and iPad but also the Windows Phone 7 emulator.

New Mobile emulators in WebMatrix 2 include iPhone

Now the Run button has more browsers as a choice. Here I've left the iPhone as the default choice.

My Run button now has an iPhone picture on it

And when I run it, I get the nice Electric Plum iPhone simulation with my current site loaded automatically. (Did you notice that WebMatrix used NuGet to install this feature? All these extensions are buried in C:\Users\YOU\AppData\Local\Microsoft\WebMatrix\Extensions\20RC currently)

Electric Plum Mobile Simulator

To add this browser to Visual Studio 2012 RC, go to the new browser button (integrated with the Debug button) while in a web project and select Browse With... and add in C:\Users\YOU\AppData\Local\Microsoft\WebMatrix\Extensions\20RC\iPhoneSimulator\ElectricMobileSim\ElectricMobileSim.exe. For arguments put in 1 for the iPhone.

Adding Electric Plum's iPhone simulator in my Visual Studio

Now, make another entry for IPad and use arguments "2" for iPad. Your VIsual Studio 2012 RC menu should now look like this.

Look, iPhone's in my Visual Studio Menu

Now, this is just using the basic version of Electric Plum that you can download inside WebMatrix. You can get a MUCH more functional version for $29.99. It will give you a developer console, GPS support, accelerometer and some additional HTML5 support like local storage, etc. If you're seriously doing iPhone websites on a Windows machine, it's a bargain and you get both iPhone and iPad plus a load of features.

(NOTE: I am NOT affliated with Electric Plum nor do I sell their products. I just think they are cool folks.)

Have fun! Do you want to see stuff like this in VS? Tell me in the comments and I'll make sure the right people see your voice!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.