Fixed Azure cert cycling and upload and cleaned up some code