简体   繁体   中英

Is there a way to import certificate from azure keyvault to azure web app in .NET?

In azure cli we have this command to import/bind certificates to azure app from keyvault.az

webapp config ssl bind --certificate-thumbprint {certificate-thumbprint} --name MyWebapp --resource-group MyResourceGroup --ssl-type SNI

I couldn't find equivalent library in .NET to do the same (I am using C#). Can anyone help in this?

Microsoft has a fluent API to access all the Azure services.

By accessing the App Service API you should be able to assign an existing certificate to it.

Thanks @john your hint was more than enough for me to look this up. The method that you pointed helps in ssl binding with the existing certificate. But I need to import the certificate in my azure web app在此处输入图像描述 . Any API for that?

var webApp1 = azure.WebApps
                .GetById(<your resouce Id as a string>)
                .Update()
                .DefineSslBinding()
                .ForHostname(<host name as a string>)
                .WithPfxCertificateToUpload(<certificate as a string>,
                    <password as a string>)
                .WithSniBasedSsl()
                .Attach()
                .Apply();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM