For our prod stack, we want our Azure app service ...
# azure
l
For our prod stack, we want our Azure app service (Web.WebApp in Pulumi) to have a custom domain (external DNS provider) and Azure managed certificate. Here's what our WebApp definition looks like right now:
Copy code
var apiAppService = new WebApp("my-app-service", new WebAppArgs
{
	ResourceGroupName = rgName,
	ServerFarmId = aspId,
	HttpsOnly = true,
	Location = "eastus",
	Identity = new ManagedServiceIdentityArgs
	{
		Type = Pulumi.AzureNative.Web.ManagedServiceIdentityType.SystemAssigned,
	},
	SiteConfig = new SiteConfigArgs
	{
		AlwaysOn = true,
		FtpsState = FtpsState.FtpsOnly,
		Http20Enabled = true,
		NetFrameworkVersion = "v6.0",
		NumberOfWorkers = 1,
		Use32BitWorkerProcess = false,
		AppSettings =
		{
			// ...
		},
		ConnectionStrings =
		{
			// ...
		}
	},
	Tags =
	{
		// ...
	},
});
The Azure portal makes it seem like setting a custom domain would happen on this WebApp resource (given that there's a "Custom Domains" blade specifically on the app service). But I don't see anything like that in the Pulumi WebApp type or in any of the types that are passed to create a WebApp. Can anyone point me in the right direction? I can usually stumble through via the Pulumi docs and looking at the ARM template from a representative Azure resource. But known-working code gives me a lot more confidence. Thanks.
m
I have never done that, but I think you could have a look at WebAppHostNameBinding and Certificate resources. I am interested in seeing what the final code looks like when you will succeed making this work
l
I've found this tutorial (python), which is almost on-point. But it references types that don't exist in the C#/.NET azure-native library, e.g.
web.CustomDomain
. So I'm not sure how to interpret that. https://python.helpful.codes/tutorials/pulumi/Setting-Up-Azure-App-Service-with-Custom-Domain-with-Pulumi/
m
It's because this tutorial was using Azure Native v1 (https://www.pulumi.com/registry/packages/azure-native/api-docs/cdn/customdomain/), some types have been replaced in v2
l
That's what I figured, but I didn't see "CustomDomain" under "web" there either (i.e. under "web" in the azure-native v1 docs). Note that there are multiple CustomDomain types, one for "appplatform", another for "cdn", etc.
Further research looks like what's described here is how to do this: https://github.com/pulumi/pulumi-azure-native/issues/578 I don't yet know if the circular dependency problem still exists or not. But if I'm reading this correctly, two things need to happen: 1. Create a Web.Certificate to obtain an Azure-managed certificate 2. Create a Web.WebAppHostNameBinding which references the certificates thumbprint Can anyone confirm that I'm interpreting this correctly? Also, if anyone knows, does the circular dependency issue still exist?