Uploading Hyper-V VHDs to Azure

I recently had a project I was working on in which some inherited Azure VMs were missing the Azure agent and nobody knew the passwords for them. After a quick support call to MS it became apparent I would have to delete the VMs and preserve the disks, download disks, load into hyper-v and manually reset the password. In doing this I learned a few gotchas such as not being able to convert the VHD into a bootable Azure disk unless uploading through the Azure Powershell CLI. Here’s my quick how to upload disks guide.

Installing Azure Powershell

First we will need to install the Azure Powershell Module. This can be accomplished by running Powershell as administrator and entering the following:

Install-Module Azure

When prompted press choose A for yes to all. 

Note: If there is any conflict you may need to add the -AllowClobber to the end of the command above.


Login To Azure and Get Publish Settings File

First you will need to log into Azure by entering the following in Powershell


At this point you will be prompted to log into Azure. 


The next step will be to get an Azure Publishing Settings file. You can do this by entering the cmdlet below and then importing the file with the following cmdlet:


Import-AzurePublishSettingsFile -PublishSettingsFile “<path to file>”


Select Your Subscription and view Storage Accounts

At this step we will choose which subscription to use (if you have more than one) and list storage accounts so that we know where to upload the disks to. 

Warning: If you attempt to upload the VHD through the web GUI instead of using this method it will be created as a block blob not a page blob which prevents you from being able to convert it to a bootable disk for use in the gallery. The only way to do this correctly at the time of this writing is through the Powershell API.


Select-AzureSubscription -SubscriptionId <enter yours here>



Uploading The Azure VHD and Converting It

At this point we are setup for the part we’ve all been waiting for. Make sure your VHD is not thin provisioned and that the VM has the Azure Agent installed and has been sys prepped (if using as a template).

Add-AzureVhd -LocalFilePath “<file path to your VHD>” -Destination “<URL of storage location with your filename after the last />”

This will create an MD5 hash and upload the disk. 


To convert the disk we will want to run the following:

Add-AzureDisk -Diskname ‘<name your disk something relevant>’ -MediaLocation ‘<URL where your disk lives in azure storage>’ -Label ‘<label>’ -OS <Choose Windows or Linux>

Atlassian Bamboo Server Github Issues

As any of you who have been using Atlassian’s cloud offering of Bamboo know, it is going EOL at the end of January 2017. The migration has reasonably decent instructions to follow, but my migration ran into a big road block when linked repositories failed when choosing Github as the repository host with a 403 forbidden. The 403 forbidden is actually in relation to a javascript error and not the actual reason that this is failing. Tailing the output of the catalina.out revealed the issue was actually related to cross site request forgery issues. The reason this was happening is that I had setup nginx as an https proxy on 443 that routes traffic to 8085 on Tomcat.


I found the following link that indicates the resolution is to insert the following into your server.xml file


What was not terribly obvious in this documentation what what section this should go into. The section this should be placed in is the <Connector section within server.xml, see example below:


<Connector port="8085"

Last but not least don’t forget to restart the service for this to take effect. Hopefully this saves you hours of headache in your migration!

End of Year Gotchas

Mac OS Sierra Git Broken After Upgrade:

Every year when a new Mac OS is released I am excited to see what new features have come down the pipe but also fearful of what is going to break. Without fail ever release since Mavericks has broken something in my environment whether it be DevOps related or Audio Engineering related. This time around it was xcode which impacted my ability to use git bash. Fortunately the fix was easy and quick.

Below is the error I received the first time I used git bash after updating.

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun


xcode-select --install

If this doesn’t resolve for you try using the –reset flag instead of –install

AWS Lambda Invocation Limits:

I’ve had the privilege of doing DevOps work for a few fairly popular mobile games over the past 6 months. About 3-4 months ago we made the switch from Tomcat backend servers and SQL to using Amazon RDS and Lambda with API Gateway. This has proven to drastically reduce total cost of ownership (TCO) and make scaling a breeze. The challenge came when we started to grow the number of Lambda functions and encountered a not so widely known limitation. Lambda has a limit of 100 requests per second, which is honestly quite a bit, however this is GLOBAL not per Lambda. The more Lambda functions you have in your account the more this will grow. I have since requested 2 increases from Amazon to prevent throttling and setup some global CloudWatch dashboards and alarms, but this is valuable information I wish I knew before limitations were encountered.