I’m using `WebAppHostNameBinding` from `azure-next...
# azure
p
I’m using
WebAppHostNameBinding
from
azure-nextgen
to add new domains to a
WebApp
. This works fine, as long as I only have one domain to add, but if I add multiple domains, then it does not work, because the previous
WebAppHostNameBinding
must be finished before I can add a new one. I currently have this:
Copy code
const subdomains = ["aa", "bb", "cc"];
for (var subd of subdomains) {
  var nameBinding = newHostNameBinding(subd, app.name, "<http://topdomain.com|topdomain.com>");
}

function newHostNameBinding(subdomain: string, appName: Input<string>, topdomain: string) {
  return new nextgen.WebAppHostNameBinding(
    `${environment}-web-host-name-binding-${subdomain}`,
    {
      name: appName,
      resourceGroupName: resourceGroup.name,
      hostName: `${subdomain}.${topdomain}`,
    },
    { parent: app }
  );
}
Ho can I ensure the calls to create a
WebAppHostNameBinding
are finished on the Azure site before creating the next one? The error I currently get is this:
Copy code
Cannot modify this site because another operation is in progress. Details: Id: 79e4dbe5-ae0e-44a2-9006-13b3e85e4e23, OperationName: Update, CreatedTime: 12/7/2020 9:53:20 AM, RequestId: d371a3b1-9503-4635-8289-2477a33ac7aa, EntityType: 3