locked
Cant load a client certificate from store RRS feed

  • Question

  • Hi!

    I want to use my Azure Function as a client to some services. For it 

    1) Upload client (pfx) certificate to App Service Settings => SSL certificates => Upload 

    2) Add a new  appsetting WEBSITE_LOAD_CERTIFICATES with value *

    3) Try to load the uploaded certificate using

            private static X509Certificate2 GetCertificate(string certificateThumbprint)
            {
                var store = new X509Store(StoreName.My, StoreLocation.CurrentUser);
                store.Open(OpenFlags.ReadOnly);
                var cert = store.Certificates.OfType<X509Certificate2>()
                    .FirstOrDefault(certificate => certificate.Thumbprint.ToLower() == certificateThumbprint.ToLower());
                store.Close();
                return cert;
            }

    or

            private static X509Certificate2 GetCertificate(string certificateThumbprint)
            {
                var store = new X509Store(StoreName.My, StoreLocation.LocalMachine);
                store.Open(OpenFlags.ReadOnly);
                var cert = store.Certificates.OfType<X509Certificate2>()
                    .FirstOrDefault(certificate => certificate.Thumbprint.ToLower() == certificateThumbprint.ToLower());
                store.Close();
                return cert;
            }

    But the certificate did not returned. 

    Why?

    Wednesday, November 16, 2016 4:38 PM

All replies

  • Client cert is not yet supported by Azure Function.   It will be in the future release (sorry for not being specific on the date).   Hopefully by end of year. 

    Suwatch

    Wednesday, November 16, 2016 5:19 PM