Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Error while accessing Azure KeyVault Secrets with Certificate in aspnetzero #9127


User avatar
0
omkarchoudhari created

I am using the latest version 8.8.0 with Angular and .NET Core. I am follllowing your teams article :** https://volosoft.com/blog/Using-Azure-Key-Vault-with-ASP.NET-Core** I have carried out all steps as mentioned and also uploaded the certificate. But when i run the project i am getting the "System.InvalidOperationException: 'Sequence contains no elements'" error in AppAzureKeyVaultConfigurer.cs file. Seems the code is not able to find the uploaded certificate which exists with the registered app on Azure.

Is there any point i have missed because with the managed service it works perfectly. But not with certificate.

Thanks.


3 Answer(s)
  • User Avatar
    0
    omkarchoudhari created

    I got this working. There were some steps involved in creating the certificate the right way.

    Thanks

  • User Avatar
    0
    marble68 created

    Anything specific others like myself should be aware of?

    Thanks!

  • User Avatar
    0
    omkarchoudhari created

    Yes. Two things.

    1. Generate a certificate (.PFX) with a private and public key using a tool like OpenSSL.
    2. Upload public key (.pem) to the registered app in the Azure portal
    3. Right-click .PFX certificate and install it in personal folder on your machine.

    I was getting the above error since my exported certificate from certmgr could not have a private key. This wasted lot of time for me to figure out.😊