Factoring out account code

https://github.com/WindowsAzure/azure-sdk-tools-xplat/issues/408