0
votes

we are having some issues with Azure management certificates.

Our Azure account contains 3 subscriptions. We are running an instance of Azure TaskScheduler under one of them

We need to set a certificate for this subscription to be able to sign into it from our ASP.NET app. We created a new self signed certificate, uploaded it in Azure settings under the subscription mentioned above, and put the BASE64 encoded version of .cer (without the private key) into our app's configuration file.

When we use it to create a new certificate with thw X509Certificate2 constructor, it succeeds. But if we attempt to use this certificate object in credentials for SchedulerClient, it fails with the following error message:

ForbiddenError: The server failed to authenticate the request. Verify that the certificate is valid and is associated with this subscription.

It is important to know that this code did work with another certificate previously, but we needed to change the certificate to fix another issue. It seems as if the new certificate is not recognized as being associated with the subscription, even though it shows up in the list of this subscription's management certificates on the Azure portal.

This URL: https://manage.windowsazure.com/publishsettings/index?client=vs&schemaversion=2.0 will return only one certificate per subscription, but the MSDN guide says up to 100 management certificates are allowed per subscription.

What should we do now? Do we have to do something special in the Azure administration to “assign” the new certificate to the scheduler or the subscription? How do we get Azure subscriptions to recognize the new certificate to make it authenticate?

1

1 Answers

0
votes

It seems that you can’t use management certificate to manage Azure Services successfully after uploaded management certificate in the settings of Azure Portal. The issue is very similar with the other SO thread with Java azure free trial account not able to authenticate via java sdk.

My suggestion is that trying to refer to the article to re-generate a new self-signed certificate and upload it in the settings of Azure classic portal. Please make sure the uploaded management certificate is exist in the MANAGEMENT CERTIFICATES tab of your settings like mine as below.

enter image description here

Then, you can refer to the reference to add the certificate to a http request or a httpclient(see the code below) for the constructor SchedulerClient(HttpClient).

X509Certificate2 certificate = GetStoreCertificate("<thumbprint>");
var clientHandler = new WebRequestHandler()
clientHandler.ClientCertificates.Add(certificate);
var client = new HttpClient(clientHandler)