Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Client-side certificate in a Metro app for Windows Azure Service Management

I'm trying to connect to the Windows Azure Service Management API. I have to provide a certificate which I previously uploaded to my azure portal. In .NET, this is very easy, as detailed here. In Metro however, you cannot attach a Certificate to the request manually. On the Microsoft forum I found this:

HttpClientHandler aHandler = new HttpClientHandler();
aHandler.ClientCertificateOptions = ClientCertificateOption.Automatic;

HttpClient aClient = new HttpClient(aHandler);
HttpResponseMessage aResp = await aClient.GetAsync("https://[azure service management uri]");

Together with giving the app the capability to use shared certificates, this should select a certificate or present the user an option to select the certificate. The certificate is in my Personal store, and I have even tried to include the certificate in the package manifest, but nothing works. It appears it just doesn't include the certificate in the request.

What is the correct way to call a REST-based API which needs a certiticate within a Metro app?

like image 666
Rob Tillie Avatar asked Aug 29 '12 10:08

Rob Tillie


1 Answers

I think I have an answer to this. Please check the certificate you're using to authenticate your requests. There needs to be 2 things in that certificate:

  1. Ensure that “Client Authentication” is enabled as one of the certificate purpose.

  2. Ensure that the certificate has “OID” specified for it.

I wrote a blog post about consuming Windows Azure Service Management API in a Windows 8 application which you can read here: http://gauravmantri.com/2012/09/08/consuming-windows-azure-service-management-api-in-a-windows-8-application/. I have covered these two issues and then some more there.

Hope this helps.

like image 168
Gaurav Mantri Avatar answered Nov 10 '22 01:11

Gaurav Mantri