简体   繁体   English

如何使用 terraform 从 ZCF04A02E37B7574FC311A key vault6 导入 azure web 应用程序证书

[英]How to import a an azure web app certificate using terraform from an azure key vault

I have a certificate for an app service in an azure keyvault, I want to import a key vault certificate to my web app in terraform but am not sure where i would refer to the keyvault in the below example?我在 azure 密钥库中有一个应用程序服务证书,我想将密钥库证书导入到 terraform 中的 web 应用程序中,但我不确定下面示例中的密钥库在哪里?

  resource "azurerm_app_service_certificate_binding" "example" {
  hostname_binding_id = azurerm_app_service_custom_hostname_binding.example.id
  certificate_id      = azurerm_app_service_managed_certificate.example.id
  ssl_state           = "SniEnabled"
}

To bind the existing key vault certificate with your webapp need to use as mentioned below by @json we need to first call key vault certificate using data then bind with webapp .要将现有的密钥保险库证书与您的 webapp 绑定,需要使用@json 下面提到的,我们需要首先使用数据调用密钥保险库证书,然后与 webapp 绑定

 //First Read the External Key Vault data "azurerm_key_vault" "production_keyvault" { name = "testingkeyvault2022" resource_group_name = "KeyVaultWestEuropeBackend" } // Now Read the Certificate data "azurerm_key_vault_secret" "prod_certificate" { name = "testcert" key_vault_id = data.azurerm_key_vault.production_keyvault.id } // Now bind the webapp to the domain and look for certificate. resource "azurerm_app_service_custom_hostname_binding" "website_app_hostname_bind" { //Website App depends_on = [ azurerm_app_service_certificate.cert, ] hostname = var.websiteurlbind app_service_name = data.azurerm_app_service.read_website_app.name resource_group_name = data.azurerm_resource_group.Terraform.name ssl_state = "SniEnabled" thumbprint = azurerm_app_service_certificate.cert.thumbprint } // Get Certificate from External KeyVault resource "azurerm_app_service_certificate" "cert" { name = "testingcert" resource_group_name = data.azurerm_resource_group.Terraform.name location = data.azurerm_resource_group.Terraform.location pfx_blob = data.azurerm_key_vault_secret.prod_certificate.value }

Note:- I have not tested due to some access issue from my end ,but it should work.注意:-由于我的一些访问问题,我没有测试过,但它应该可以工作。

Please find this SO THREAD for more information.请查找此SO THREAD以获取更多信息。

If still the issue persists please re-open at this GitHub issue.如果问题仍然存在,请在此GitHub问题处重新打开。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 powershell 将 Azure 密钥保管库证书导入应用服务? - Import Azure key vault certificate to app service using powershell? Azure:在应用服务中使用从 Key Vault 获得的证书时出错 - Azure : Error using certificate obtained from Key Vault in App Service 使用密钥保管库中的证书创建 Azure Web 应用 SSL 绑定 - Create Azure web app SSL binding using certificate from key vault 在管道中使用来自 Azure 密钥保管库的证书 - Using certificate from Azure key vault in pipeline 将 SSL 证书从 Azure 密钥保管库检索到 Azure 应用服务 - Retrieving SSL certificate from Azure key vault to Azure app service Azure Key Vault证书未与Web应用程序自动同步 - Azure Key Vault certificate not syncing automatically with web app 无法从 Azure Web App 连接到 Azure Key Vault - Unable to connect to Azure Key Vault from Azure Web App 从 Logic App 中的 Azure Key Vault 获取证书 - Get a certificate from Azure Key Vault in Logic App Key Vault中的Azure证书不适用于应用程序服务 - Azure certificate in Key Vault not valid for app service 如何从 Azure 密钥库中的证书获取私钥? - How to Get Private Key from Certificate in an Azure Key Vault?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM