08 May 2015

Azure | Generate a certificate for Azure Automation

If you need a certificate for automation with Azure Runbooks you just have to execute MakeCert which is part of the Windows Software Development Kit for Windows 8. If not already installed just download it and install at least the certification part.

SDK 8.0

"C:\Program Files (x86)\Windows Kits\8.0\bin\x64\makecert.exe" -sky exchange -r -n "CN=MyCert" -pe -a sha256 -len 2048 -ss My "MyCert.cer" 

SDK 8.1
 "C:\Program Files (x86)\Windows Kits\8.1\bin\x64\makecert.exe" -sky exchange -r -n "CN=MyCert" -pe -a sha256 -len 2048 -ss My "MyCert.cer"

If you are not on a 64 Bit machine the folder is x86 instead of x64. But I guess this is obviouse.

If this runs correctly, you will see the message “Succeeded”. The certificate will be created as MyCert.cer file in the current directory, and the certificate will be saved to the machine’s certificate store.

After that start a PowerShell as administrator and type in the following commands:

$MyPwd = ConvertTo-SecureString -String "GEHEIM" -Force –AsPlainText 
(choose whatever password you like)

$AzureCert = Get-ChildItem -Path Cert:\CurrentUser\My | where {$_.Subject -match "MyCert”} 
(replace MyCert with the name you gave your certificate with MakeCert)

Export-PfxCertificate -FilePath C:\MyCert.pfx -Password $MyPwd -Cert $AzureCert

The last command will create the MyCert.pfx in the c:\ drive of your computer. Which than can be used to upload to Azure Automation.
Post a Comment