Handling issue: Csmanage cannot establish secure connection to management.core.windows.net

CSMANAGE tool is developed using Azure Service Management API and located at:

https://code.msdn.microsoft.com/Release/ProjectReleases.aspx?ProjectName=windowsazuresamples&ReleaseId=3233

It is possible that you may encounter the following error when using this tool:

 

c:>csmanage.exe
/list-hosted-services

Could
not establish secure connection for SSL/TLS with authority
'management.core.windows.net

 

Based on above problem details, it
is possible that the certificate you are using with CSMANAGE.EXE.CONFIG is a self signed key based certificate. The application may not trust the key used in the CSMANAGE.EXE.CONFIG or their may not be a way for the application to trust the certificate as there may not be a chain to validate or a certificate
revocation list.

To solve this problem you can just create a simple certificate
as describe below using MAKECERT and solve this problem.

 

Step 1: Create Certificate in
the “My” Certificate store:

1.
Open the VS2010 command window to create a certificate (Change
the CN value to your word of choice):

 

C:\Applications>makecert
-r -pe -n "CN=Avkash
Windows Azure Portal Cert" -b 01/01/2010 -e 01/01/2015 -sky exchange
-ss my

 

Succeeded

 

2.
This certificate will be available in “Current User ->
Personal (My) Certificate Store” as below:

 

3.
Now you can export this certificate to CER (Do not export
private key) and save as CER File.

 

Step 2: Upload above created
CER file to Azure Portal:

 

1.
Upload the certificate to Azure Portal at “Management
Certificate” section

Step 3: Working with CSMANAGE Tool:

 

Update your csmanage.exe.config file with *correct*
Subscription ID and above certificate Thumbprint ID:

 

<appSettings>

    <add
key="CheckServerCertificate" value="true"/>

    <!-- Insert your subscriptionId as shown
by the Windows Azure developer portal -->

    <add key="SubscriptionId" value="***********************************"/>

    <!-- Insert your certificate thumbprint
without spaces -->

    <add
key="CertificateThumbprint" value="A77B44AD5556DFDB11A3B245453A548B2D7B0099"/>

  </appSettings>

Run CSMANAGE Tool:

 

C:\Windows\system32>csmanage /list-hosted-services

Using certificate: CN=Avkash Windows Azure Portal Cert

Listing HostedServices

HostedServiceList contains 1 item(s).

HostedService Name:Avkash13test

HostedService Url:https://management.core.windows.net/6b2a323b-****-****-***-******a3adca/services/hostedservices/Avkash13test

Operation ID: 4d1a45d134974c149054f8d405a11111

HTTP Status Code: OK

StatusDescription: OK