Is API support available to import certificate from keyvault to Azure web app?

Simranjeet Singh 21 Reputation points
2021-01-22T11:36:02.457+00:00

I am working in .NET and I have met a requirement where I need to import certificate from keyvault to azure web app. I have found the solution in azure cli but couldn't find anything for API, which I can use in .NET.

Using powershell: az webapp config ssl import --resource-group ${RESOURCE_GROUP} --name ${appServiceName} --key-vault ${KEYVAULT_NAME} --key-vault-certificate-name ${KEYVAULT_CERTIFICATE_NAME}

Need to know how to do the same using fluent API.
59557-image.png

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,535 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,095 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,006 questions
{count} votes

Accepted answer
  1. Grmacjon-MSFT 18,641 Reputation points
    2021-01-29T04:05:50.18+00:00

    Hi @Simranjeet Singh ,

    After talking to the product team it looks like there is no API that does all the work of import, as we do some KV permission checking/setting. However, you can use the create or update call, with the proper parameters:

    CertificatesOperationsExtensions.CreateOrUpdate(ICertificatesOperations, String, String, Certificate) Method (Microsoft.Azure.Management.WebSites) - Azure for .NET Developers
    Create or update a certificate

    You would need to set the keyvault secret name, keyvault id, and serverfarm to be the ones of the site you wish to import the certificate to. A sample body can be seen in this article

    Hope that helps.

    Best,
    Grace

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.