1

How do I add a custom domain name in Azure AD via an automation tool or CLI? I would like to mimic the manual steps in the Azure Portal (Azure AD -> Custom Domain Names -> Add custom domain -> enter domain name -> enter settings for custom domain name -> verify).

I have been scouring Azure Powershell and Azure CLI documentation, but have been unable to find a solution to this problem. Struggling to find a solution in Terraform too. Is it possible to automate this task?

The reason for this is because I am trying to workaround not being able to create an enterprise application programmatically - any help there would also be appreciated.

SoySolisCarlos
  • 736
  • 1
  • 6
  • 13

1 Answers1

1

You only can do it via API REST:

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}?api-version=2022-03-01

More Info: https://learn.microsoft.com/en-us/rest/api/appservice/domains/create-or-update?tabs=HTTP

Via terraform you only can use the Data Source azuread_domains (https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/data-sources/domains)

SoySolisCarlos
  • 736
  • 1
  • 6
  • 13