There's a couple of problems with this script:
- Unless you've set a default storage account (which the link doesn't) for your subscription you'll need to use -MediaLocation switch in the first CmdLet
- If you pipe the first CmdLet into second as you are you won't need the -VM switch which in your case references a string literal rather than $vm.
Some of the VM documentation can contain inconsistencies a much better reference point to get started is Michael Washam's blog http://michaelwasham.com or this may help you if you swap out the sql image for the one you're interested in http://blog.elastacloud.com/2012/06/30/tricks-with-iaas-and-sql-part-1-installing-sql-server-2012-vms-using-powershell/