Skip to content

Instantly share code, notes, and snippets.

@codingoutloud
Created September 22, 2012 21:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codingoutloud/3767941 to your computer and use it in GitHub Desktop.
Save codingoutloud/3767941 to your computer and use it in GitHub Desktop.
Create a Windows Azure Management certificate for use with the Service Management API. This is also useful for using the "Publish" option from Visual Studio. A -private option can be used to also create a .pvk. You will need the private key (.pvk) if you
@echo off
rem - Generate a self-signed certificate useful for use with the Windows Azure Service Management API
if .%1.==.. goto USAGE
if .%2.==.. goto USAGE
if "%3"=="-private" goto PRIVATE
makecert.exe -r -pe -n %1 -ss My -sky exchange -sp "Microsoft Enhanced RSA and AES Cryptographic Provider" -sy 24 %2.cer
goto END
:PRIVATE
makecert.exe -r -pe -n %1 -ss My -sky exchange -sp "Microsoft Enhanced RSA and AES Cryptographic Provider" -sy 24 -sv %2.pvk %2.cer
goto END
:USAGE
echo.
echo USAGE:
echo make-waz-management-cert COMMON-NAME-STRING FILESPEC-WITHOUT-EXTENSION [-private]
echo Including the optional -private parameter will prompt for passwords and will create FILESPEC-WITHOUT-EXTENSION.pvk
echo in addition to FILESPEC-WITHOUT-EXTENSION.cer.
echo.
echo EXAMPLE:
echo %0 "CN=WAZ Mgmt (Bill Wilder)" billw-waz-mgmt
echo.
echo RESULTS IN:
echo makecert.exe -r -pe -n "CN=WAZ Mgmt (Bill Wilder)" -ss My -sky exchange -sp "Microsoft Enhanced RSA and AES Cryptographic Provider" -sy 24 billw-azure-mgmt.cer
echo.
echo To include the local machine name as part of your certificate name, change the first parameter to something like:
echo "CN=WAZ Mgmt (Bill Wilder - %%COMPUTERNAME%%)"
echo Note that the local machine name is less useful when the full certificate (private key) is being shared across multiple
echo machines (so they can all publish with the same credentials) since the "local" machine name is no longer correct (or meaningful).
echo.
:END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment