chilly-analyst-14900
08/31/2022, 12:20 PMvar binding = new WebAppHostNameBinding($"binding.api{stack}.<http://domain.app|domain.app>", new WebAppHostNameBindingArgs
{
Name = app.Name,
ResourceGroupName = resourceGroup.Name,
CustomHostNameDnsRecordType = CustomHostNameDnsRecordType.CName,
HostName = fulldomain,
SiteName = app.Name,
// Thumbprint = certificate.Thumbprint // Cannot set, need to create the managed domain cert first
// SslState = SslState.SniEnabled // Cannot set, need to create the managed domain cert first
}, new CustomResourceOptions{ DependsOn = new CustomResource[] { txtRecord, cnameRecord }});
var certificate = new Certificate($"domain-app-cert-{stack}", new CertificateArgs
{
ServerFarmId = appServicePlan.Id,
ResourceGroupName = resourceGroup.Name,
CanonicalName = fulldomain,
HostNames = new[] { fulldomain }
}, new CustomResourceOptions { DependsOn = binding}); // requires a hostname binding to exist for the domain
tall-librarian-49374
08/31/2022, 12:20 PMchilly-analyst-14900
08/31/2022, 12:22 PMchilly-analyst-14900
08/31/2022, 12:22 PMchilly-analyst-14900
08/31/2022, 12:23 PMchilly-analyst-14900
08/31/2022, 12:24 PMchilly-analyst-14900
08/31/2022, 12:39 PMaz
CLI:
az webapp config ssl bind --certificate-thumbprint $thumbprint --ssl-type SNI --name $webapp --resource-group $resourceGroupmicroscopic-furniture-52860
08/31/2022, 3:47 PMPulumi.Command
immediately after creation of the cert. Note that it also needs a delete
command, else a destroy can’t tear down the cert.
var command = new Command("apply-cert-binding", new CommandArgs
{
Create = "az webapp config ssl bind --certificate-thumbprint $THUMBPRINT --ssl-type SNI --name $APP_NAME --resource-group $RESOURCE_GROUP_NAME",
Delete = "az webapp config ssl unbind --certificate-thumbprint $THUMBPRINT --name $APP_NAME --resource-group $RESOURCE_GROUP_NAME",
Environment =
{
{ "THUMBPRINT", cert.Thumbprint },
{ "APP_NAME", app.Name },
{ "RESOURCE_GROUP_NAME", resourceGroup.Name }
}
}, new CustomResourceOptions
{
DependsOn = cert
});
chilly-analyst-14900
08/31/2022, 3:48 PMchilly-analyst-14900
08/31/2022, 4:19 PMchilly-analyst-14900
08/31/2022, 4:20 PM