Hey Team, I'm stuck in an issue with azure app con...
# azure
r
Hey Team, I'm stuck in an issue with azure app container custom domain with managed certificate. I'm getting this error when running my code below:
error: Code="RequireCustomHostnameInEnvironment" Message="Creating managed certificate requires hostname '<http://api.exmaple.com|api.exmaple.com>' added as a custom hostname to a container app in environment 'x'"
Copy code
// code above ............

const containerApp = new app.ContainerApp("api", {
    resourceGroupName: resourceGroup.name,
    managedEnvironmentId: managedEnv.id,
    configuration: {
        ingress: {
            external: true,
            targetPort: 3000,
            transport: "auto",
            clientCertificateMode: azureNative.app.IngressClientCertificateMode.Accept,
            corsPolicy: {
              allowCredentials: true,
              allowedHeaders: ["*"],
              allowedMethods: ["GET", "POST", "PUT", "DELETE"],
              allowedOrigins: [ "<https://example.com>"],
          },
          customDomains: [
            {
              name: "api.example.com",
              bindingType: "Custom",
            }
          ],
        },
        registries: [{
            server: registry.loginServer,
            username: adminUsername,
            passwordSecretRef: "pwd",
        }],
        secrets: [{
            name: "pwd",
            value: adminPassword,
        }],
    },
    template: {
        containers: [{
            name: "fastify-api",
            image: myImage.imageName,
        }],
    },
});

// Create a managed certificate
const managedCertificate = new azureNative.app.ManagedCertificate("managed-certificate", {
  resourceGroupName: resourceGroup.name,
  environmentName: managedEnv.name,
  location: resourceGroup.location,
  properties: {
      subjectName: "api.example.com",
      domainControlValidation: "CName",
  },
});

// Add a custom domain to the container app with the managed certificate
const customDomain = new azureNative.appplatform.CustomDomain("api2-attrove-com", {
  resourceGroupName: resourceGroup.name,
  serviceName: containerApp.name,
  appName: containerApp.name,
  domainName: "api.example.com",
  properties: {
      certName: managedCertificate.name,
      // thumbprint: managedCertificate.properties.thumbprint,
  },
});
Any suggestion?
b
I believe there is still a chicken/egg issue with ACA and managed certs.
🫤 1