azurerm_app_service_certificate issue when creating multiple App Service certificates backended by same Key Vault Cert #4991
Labels
bug
service/app-service
service/key-vault
Key Vault
upstream/terraform
This issue is blocked on an upstream issue within Terraform (Terraform Core/CLI, The Plugin SDK etc)
Community Note
Terraform (and AzureRM Provider) Version
Affected Resource(s)
azurerm_app_service_certificate
Terraform Configuration Files
Expected Behavior
I expect this to create 2 App Service Certificates in the
ui-test
resource group that can be bound to a hostname.Actual Behavior
I am not sure if this is a Terraform issue or a bug with the Azure SDK under the covers. What happens is that both resources are created, and can be accessed using the path:
/subscriptions/ab4c26b1-1234-488b-1234-894d862f9816/resourceGroups/ui-test/providers/Microsoft.Web/certificates/india
and
/subscriptions/ab4c26b1-1234-488b-1234-894d862f9816/resourceGroups/ui-test/providers/Microsoft.Web/certificates/india
The problem is that only the first one created becomes available in the App Service for that region. The second one we created with a different name but backed by the same Azure Key Vault Certificate exists but can't be viewed inside the App Service so it cannot be used.
I have noticed if you try to do this process through the GUI you cannot name the cert - it auto names it for you in the format
keyvaultName-certName
so in our example it would be calledtest-kv-certTest
which would prevent me adding a second cert backed by the same KeyVault ID as it would create a duplicate name in the resource group (albeit in different regions).Steps to Reproduce
1 - upload a PFX cert to KeyVault
2 - Use the
azurerm_app_service_certificate
resource to add a cert to a resource group (let's call ittest
) in a location - (let's use india) using the ID of the cert you added to KeyVault3 - Create another
azurerm_app_service_certificate
resource using the same Key Vault ID and the same resource group, but use a different location (let's use australia).4 - Navigate through the UI to India Azure App Service and look under TLS/SSL settings and Private Key Certificates and see the cert available to use.
5 - Navigate through the UI to Australia Azure App Service and look under TLS/SSL settings and Private Key Certificates and see that the cert isn't there.
The text was updated successfully, but these errors were encountered: