-1

Here is my cert code portion

Getting Certs code :

resource certificateName_resource 'Microsoft.Web/certificates@2021-02-01' = {
  name: certificates_name
  location: resourceGroup().location
  properties: {
    keyVaultId: kv_externalid
    keyVaultSecretName: certificates_name
    serverFarmId: serverFarmID
  }
}


sslCertificates: [
      {
        name: 'ListenerHTTPS'
        properties: {
          keyVaultSecretId: certificateName_resource.id
          
        }
      }
    ]

Here is code from Microsoft docs:
sslCertificates: [
      {
        name: 'appGatewayFrontEndSslCert'
        properties: {
          data: frontendCertData
          password: frontendCertPassword
        }
      }
    ]

I'm getting deployment error while deploying this code Code error: KeyVaultWebService_SecretNotFound

Abkade
  • 1
  • 2

1 Answers1

1

keyVaultSecretId should be a keyvault secret ID. The ID you're giving it is for a resource of the type Microsoft.Web/certificates. That's not a keyvault secret.

You should put the certificate in a keyvault, and then reference it using a resource of the appropriate type: https://learn.microsoft.com/en-us/azure/templates/microsoft.keyvault/vaults/secrets?tabs=bicep

Daniel Mann
  • 57,011
  • 13
  • 100
  • 120