Import Azure key vault certificate to app service using powershell?

Viewed 1318

I have created a azure key vault and uploaded a certificate. Now I want to import the certificate into Azure app service using PowerShell. Most of the scripts I have looked suggests to download it in local and then to upload. Since I'm planning to put the script in pipeline. I can't do it.

Is there any PowerShell command to import key vault certificate into Azure app service directly.

Examples I seen :

New-AzWebAppSSLBinding -WebAppName ppldemosslkeypipeline -ResourceGroupName keyappservice_pipeline -Name ppldemosslkeypipeline -CertificateFilePath $pfxPath -CertificatePassword $pfxPassword -SslState SniEnabled

Instead of providing the certifcate file path is there any way i can provide key vault certifcate place holder using azure keyvault url.

enter image description here

1 Answers

I believe it is a 2 step process:

  1. You will need to import the certificate stored into your Azure Key Vault into your App Service. You can use Import-AzWebAppKeyVaultCertificate Cmdlet to do so.

  2. Bind this certificate to your App Service. You can use New-AzWebAppSSLBinding by specifying the certificate thumbprint for that purpose.

Related