magnificent-eve-10499
02/06/2025, 4:36 PMcontainerapp
that uses an Azure managed certificate
for a subdomain. I create the managed environment and then get the customDomainVerificationId
for the txt
entries I need to make in cloudflare. I still need the fqdn
suffix that will be used to create the cname
records but I dont see how to get that until after the container app has been created. I need the cname record to create the DNS entry in order to create the managed cert. but I need the managed cert to create the containerapp with a customDomain
.
I tried creating the contianerapp without the custom domain and then updating it after creating the managed cert but it did not seem to work I get a generic 500 error.
Diagnostics:
azure-native:app/v20241002preview:ManagedCertificate (cmsCert):
error: Status=500 Code="InternalServerError" Message="Internal server error occurred. correlation ID: d02faf16-f6a7-43d3-9c5a-6b1201182fd8"
Also the container app doesnt have any custom domains on it even though pulumi showed it as successful.freezing-jelly-32585
02/11/2025, 6:52 PMmagnificent-eve-10499
02/12/2025, 5:10 AMbindingType: 'Disabled', name: `${Subdomain}.${domain}`
• get the fqdn and domain verification from the app
const siteFQDN = myContainerApp.configuration.apply(fqdn => fqdn?.ingress?.fqdn ?? "localhost");
const nginxCvid = myContainerApp.customDomainVerificationId.apply(cvid => cvid);
• Create the DNS entries (in my case I use cloudflare)
const zone = cloudflare.getZone({ name: domain });
// Create DNS records
const CNAME = new cloudflare.Record(Subdomain, {
zoneId: zone.then((z: cloudflare.GetZoneResult) => z.id),
name: `${Subdomain}.${domain}`,
type: "CNAME",
content: siteFQDN,
ttl: 3600,
},{dependsOn: [managed_env, myContainerApp]});
const TXT = new cloudflare.Record(`asuid.${Subdomain}`, {
zoneId: zone.then((z: cloudflare.GetZoneResult) => z.id),
name: `asuid.${cmsSubdomain}.${domain}`,
type: "TXT",
content: nginxCvid,
ttl: 3600,
},{dependsOn: [managed_env, myContainerApp ]});
• Create the certificates
const Cert = new azure_app.ManagedCertificate("Cert", {
resourceGroupName: resourceGroupName,
environmentName: environment.name,
managedCertificateName: `${Subdomain}`,
properties: {
domainControlValidation: "CNAME",
subjectName: `${Subdomain}.${domain}`,
},
}, { dependsOn: [myContainerApp] });
• Bind the cert to the custom domain in the app.
// Use azure-native to bind custom domains with the managed certificates
const bindCommand = new command.local.Command("custom-domain", {
create: pulumi.interpolate `az containerapp hostname bind \
--hostname ${Subdomain}.${domain} \
-g ${resourceGroupName} -n ${myContainerApp.name} \
--environment ${environment.name} \
--validation-method CNAME`,
triggers: [Cert.systemData.lastModifiedAt,myContainerApp.systemData.lastModifiedAt],
}, { dependsOn: [cmsCert, myContainerApp, environment] });
freezing-jelly-32585
02/12/2025, 7:51 AMfreezing-jelly-32585
02/12/2025, 8:29 AMmagnificent-eve-10499
02/12/2025, 5:18 PM