Makecert – Azure Management Certificates

I have created this article as a reference for myself when I need to create an Azure management certificate for various tasks such as setting up Azure automation for example.  I hope you find this useful too.

Tip:- if you regularly work with Azure then I would advise you install the SDK as soon as you can when you are on a good internet connection as it is ~300Mb. It’s worth having as part of your standard computer build.

 

Create and Upload an Azure Management Certificate

You will need a tool called Makecert and this is available as part of the Windows SDK available here.

You will need the Windows SDK so download the installer (less than 1Mb), run it and just select the top option.

image_thumb[19]

Once installed  create the certificate via the command line.

I have used the script found on this blog which is every useful.

http://blogs.technet.com/b/cbernier/archive/2014/01/17/create-a-self-signed-certificate-for-use-with-windows-azure-using-a-windows-script.aspx

@echo off
echo This script will create an Azure certificate and export for use in Windows Azure.
echo.
echo Computer Name
echo %computername%
echo.
echo creating folder: %SystemDrive%\certs
mkdir %SystemDrive%\certs
%SystemDrive%
cd certs
echo.
dir “C:\Program Files (x86)\Windows Kits\8.1\bin\x64” | findstr /i “makecert.exe”
IF ERRORLEVEL = 1 GOTO ERROR
IF ERRORLEVEL = 0 GOTO CreateCert
echo.
:CreateCert
echo creating cert and placing it in %SystemDrive%\certs
echo.
“C:\Program Files (x86)\Windows Kits\8.1\bin\x64\makecert.exe” -r -pe -n CN=%computername%-AzureCert -ss my -sr localmachine -eku 1.3.6.1.5.5.7.3.2 -len 2048 -e 01/01/2016 automation-AzureCert.cer
echo.
echo.
goto end
:ERROR
echo makecert.exe file not found. Please check directory path above or download and install the Windows 8.1 SDK from http://www.microsoft.com/click/services/Redirect2.ashx?CR_EAC=300135395
goto end
:end

Create a .bat file with the above script or feel free to alter the dates etc.  Run it and the certificate is created.

image_thumb[23]

The certificate is created in the C:\certs folder and imported into the machines personal certificate store.

To export a PFX file for possible later use export the certificate from MMC, Details tab of the certificate, Copy to File.

image_thumb[30]

Click next on the first box,then select export private key.

image_thumb[32]

Leave defaults and press next.

image_thumb[34]

specify a password

image_thumb[36]

Enter the location to save the file and exit.

You can now upload this certificate in the Azure portal, under settings, management certificates, upload.

Upload The Azure Management Certificate

Return to the Azure Portal and upload the management certificate.

image_thumb[25]

 

I hope you found this useful.

Thanks for reading.

Advertisements

About Mitesh Chauhan
Mitesh Chauhan, Azure Cloud Solutions Architect. This is my blog where I share articles and thoughts on IT Infrastructure and architecture. The topics I am most passionate about are Implementation and architecture of rock solid Cloud Infrastructure based around SQL Server and Windows Server mainly using Microsoft Azure. MCTS - Azure Architecture MCTS - Azure Implementation MCSE Server Infrastructure (Windows Server 2012) , MCITP SQL Server 2008, Togaf Certified, Prince 2 Practitioner.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: