Hi there! Im trying to work out how to use azure C...
# azure
c
Hi there! Im trying to work out how to use azure ContainerApp with a custom domain and managed certificate. I have found that within ContainerApp configuration, within ingress you can provide a customer_domains url and Ive also found you can create a managed certificate with app.ManagedCertificate. However when I do the following:
Copy code
api_host = "<http://api.example.com|api.example.com>"

certificate = app.ManagedCertificate(
    "api-certificate",
    resource_group_name=resource_group.name,
    environment_name=managed_env.name,
    properties=app.ManagedCertificatePropertiesArgs(
        domain_control_validation=app.ManagedCertificateDomainControlValidation.CNAME,
        subject_name=api_host,
    )
)

ContainerApp(
   ...
   configuration = ConfigurationArgs(
       ...
       ingress=app.IngressArgs(
          ...
          custom_domains=app.CustomDomainArgs(
            name=api_host,
            certificate_id=certificate.id
          )
       )
   )
)
I get this error:
Copy code
Code="RequireCustomHostnameInEnvironment" Message="Creating managed certificate requires hostname '<http://api.example.com|api.example.com>' added as a custom hostname to a container app in environment 'enva668bdaa'"
I'm very new to azure so assume Im just missing something but it feel like the error is saying I can't create the certificte before the container app but I also can't create the container app before the certifacte so Im a bit lost
f
This looks very similar to an issue I reported to the Container Apps team: https://github.com/microsoft/azure-container-apps/issues/525
c
Ah yes I hit the same issue you reported when trying to set the custom domain in the managed environment. Thanks for sharing! I'll keep an eye on this issue