0
votes

I seem to be having an issue with Azure self-signed certificates. I create a self signed certificate and upload it to the Azure management portal. I then use the Azure Managed API for C# to access the portal correctly. However, after 2 days my certificate gets invalidated and I need to create a new one.

My question is why does my completely valid certificate invalidate itself?

My Process is as follows:

  1. Create certificate

    makecert.exe -r -pe -n CN=MyComputerName-AzureCert -ss my -sr localmachine -eku 1.3.6.1.5.5.7.3.2 -len 2048 -e 01/01/2016 MyComputerName-AzureCert.cer

  2. Upload certificate to management portal

  3. Call Azure Rest Api from C# (Excerpt)

    X509Certificate2 cert = new X509Certificate2(filePath); var credentials = CreateCredentialsFromCertification(subscriptionId, cert);

    //...code omitted for brevity

    CreateCloudServiceAsync(credentials, label, location, serviceName)

    //Works!

  4. Call Step 3 again a few days later

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

  5. Check Azure : Certificate still exists.

  6. Check Machine: Certificate still exists with expiration date of 2016

Does anyone have any idea what would cause this? Am I missing a step? Would I need to import my certificate into the machine? Why would it work and then stop?

Any input would be greatly appreciated :)

1
Please note that I have invested heavily in the managed API and cannot change at this point.Elixir

1 Answers

0
votes

I notice you are specifying the end of the validity period using the "-e" parameter. If omitted, the default is 12/31/2039 11:59:59 GMT. Why not try with that parameter omitted to see if that changes anything. Sounds like you are going to be using the Service Management APIs for a long time so maybe 2039 isn't too much of a stretch? ;)

You might want to check the cert's validity period after generation just to verify what you passed in is being applied.