Get a free AWS Well-Architected Assessment ->

Microsoft Azure

Active Directory

Azure Active Directory (Azure AD) is a cloud-based identity and access management (IAM) service that allows organizations to manage user access and authentication to various cloud and on-premises applications and services. Azure AD also provides access management capabilities, allowing organizations to control user access to applications and services based on their roles, groups, and permissions. It supports role-based access control (RBAC), which allows organizations to define roles and permissions for different users and groups, and assign them to specific resources. Azure AD integrates with various Azure services and other Microsoft products, such as Office 365, Azure Portal, and Dynamics 365, as well as with third-party applications and services. It also provides advanced security features, such as identity protection, threat detection, and conditional access policies, which help organizations secure their identities and data. Azure AD provides a single sign-on (SSO) experience for users, allowing them to authenticate once and access multiple applications and services without needing to sign in again. It supports various authentication methods, including username and password, multi-factor authentication, and social identity providers such as Google, Facebook, and Microsoft accounts.‍
aws cost
Direct Cost
Indirect Cost
No items found.
Terraform Name
Active Directory

The following arguments are supported:

  • domain_name - (Required) The Active Directory domain to use. See official documentation for constraints and recommendations. Changing this forces a new resource to be created.
  • domain_configuration_type - (Optional) The configuration type of this Active Directory Domain. Possible values are FullySynced and ResourceTrusting. Changing this forces a new resource to be created.
  • filtered_sync_enabled - (Optional) Whether to enable group-based filtered sync (also called scoped synchronisation). Defaults to false.
  • secure_ldap - (Optional) A secure_ldap block as defined below.
  • location - (Required) The Azure location where the Domain Service exists. Changing this forces a new resource to be created.
  • name - (Required) The display name for your managed Active Directory Domain Service resource. Changing this forces a new resource to be created.
  • notifications - (Optional) A notifications block as defined below.
  • initial_replica_set - (Required) An initial_replica_set block as defined below. The initial replica set inherits the same location as the Domain Service resource.
  • resource_group_name - (Required) The name of the Resource Group in which the Domain Service should exist. Changing this forces a new resource to be created.
  • security - (Optional) A security block as defined below.
  • sku - (Required) The SKU to use when provisioning the Domain Service resource. One of Standard, Enterprise or Premium.
  • tags - (Optional) A mapping of tags assigned to the resource.

A secure_ldap block supports the following:

  • enabled - (Required) Whether to enable secure LDAP for the managed domain. For more information, please see official documentation on enabling LDAPS, paying particular attention to the section on network security to avoid unnecessarily exposing your service to Internet-borne bruteforce attacks.
  • external_access_enabled - (Optional) Whether to enable external access to LDAPS over the Internet. Defaults to false.
  • pfx_certificate - (Required) The certificate/private key to use for LDAPS, as a base64-encoded TripleDES-SHA1 encrypted PKCS#12 bundle (PFX file).
  • pfx_certificate_password - (Required) The password to use for decrypting the PKCS#12 bundle (PFX file).

A notifications block supports the following:

  • additional_recipients - (Optional) A list of additional email addresses to notify when there are alerts in the managed domain.
  • notify_dc_admins - (Optional) Whether to notify members of the AAD DC Administrators group when there are alerts in the managed domain.
  • notify_global_admins - (Optional) Whether to notify all Global Administrators when there are alerts in the managed domain.

An initial_replica_set block supports the following:

  • subnet_id - (Required) The ID of the subnet in which to place the initial replica set. Changing this forces a new resource to be created.

A security block supports the following:

  • kerberos_armoring_enabled - (Optional) Whether to enable Kerberos Armoring. Defaults to false.
  • kerberos_rc4_encryption_enabled - (Optional) Whether to enable Kerberos RC4 Encryption. Defaults to false.
  • ntlm_v1_enabled - (Optional) Whether to enable legacy NTLM v1 support. Defaults to false.
  • sync_kerberos_passwords - (Optional) Whether to synchronize Kerberos password hashes to the managed domain. Defaults to false.
  • sync_ntlm_passwords - (Optional) Whether to synchronize NTLM password hashes to the managed domain. Defaults to false.
  • sync_on_prem_passwords - (Optional) Whether to synchronize on-premises password hashes to the managed domain. Defaults to false.
  • tls_v1_enabled - (Optional) Whether to enable legacy TLS v1 support. Defaults to false.

Associating resources with a
Active Directory
Resources do not "belong" to a
Active Directory
Rather, one or more Security Groups are associated to a resource.
Active Directory
via Terraform:
The following HCL manages an Active Directory Domain Service

provider "azurerm" {
 features {}

resource "azurerm_resource_group" "deploy" {
 name     = "example-resources"
 location = "West Europe"

resource "azurerm_virtual_network" "deploy" {
 name                = "deploy-vnet"
 location            = azurerm_resource_group.deploy.location
 resource_group_name =
 address_space       = [""]

resource "azurerm_subnet" "deploy" {
 name                 = "deploy-subnet"
 resource_group_name  =
 virtual_network_name =
 address_prefixes     = [""]

resource "azurerm_network_security_group" "deploy" {
 name                = "deploy-nsg"
 location            = azurerm_resource_group.deploy.location
 resource_group_name =

 security_rule {
   name                       = "AllowSyncWithAzureAD"
   priority                   = 101
   direction                  = "Inbound"
   access                     = "Allow"
   protocol                   = "Tcp"
   source_port_range          = "*"
   destination_port_range     = "443"
   source_address_prefix      = "AzureActiveDirectoryDomainServices"
   destination_address_prefix = "*"

 security_rule {
   name                       = "AllowRD"
   priority                   = 201
   direction                  = "Inbound"
   access                     = "Allow"
   protocol                   = "Tcp"
   source_port_range          = "*"
   destination_port_range     = "3389"
   source_address_prefix      = "CorpNetSaw"
   destination_address_prefix = "*"

 security_rule {
   name                       = "AllowPSRemoting"
   priority                   = 301
   direction                  = "Inbound"
   access                     = "Allow"
   protocol                   = "Tcp"
   source_port_range          = "*"
   destination_port_range     = "5986"
   source_address_prefix      = "AzureActiveDirectoryDomainServices"
   destination_address_prefix = "*"

 security_rule {
   name                       = "AllowLDAPS"
   priority                   = 401
   direction                  = "Inbound"
   access                     = "Allow"
   protocol                   = "Tcp"
   source_port_range          = "*"
   destination_port_range     = "636"
   source_address_prefix      = "*"
   destination_address_prefix = "*"

resource "azurerm_subnet_network_security_group_association" "deploy" {
 subnet_id                 =
 network_security_group_id =

resource "azuread_group" "dc_admins" {
 display_name     = "AAD DC Administrators"
 security_enabled = true

resource "azuread_user" "admin" {
 user_principal_name = ""
 display_name        = "DC Administrator"
 password            = "Pa55w0Rd!!1"

resource "azuread_group_member" "admin" {
 group_object_id  = azuread_group.dc_admins.object_id
 member_object_id = azuread_user.admin.object_id

resource "azuread_service_principal" "example" {
 application_id = "2565bd9d-da50-47d4-8b85-4c97f669dc36" // published app for domain services

resource "azurerm_resource_group" "aadds" {
 name     = "aadds-rg"
 location = "westeurope"

resource "azurerm_active_directory_domain_service" "example" {
 name                = "example-aadds"
 location            = azurerm_resource_group.aadds.location
 resource_group_name =

 domain_name           = ""
 sku                   = "Enterprise"
 filtered_sync_enabled = false

 initial_replica_set {
   subnet_id =

 notifications {
   additional_recipients = ["", ""]
   notify_dc_admins      = true
   notify_global_admins  = true

 security {
   sync_kerberos_passwords = true
   sync_ntlm_passwords     = true
   sync_on_prem_passwords  = true

 tags = {
   Environment = "prod"

 depends_on = [

Active Directory
via CLI:

az ad ds create --domain
               [--domain-config-type {FullySynced, ResourceTrusting}]
               [--external-access {Disabled, Enabled}]
               [--filtered-sync {Disabled, Enabled}]
               [--ldaps {Disabled, Enabled}]
               [--notify-dc-admins {Disabled, Enabled}]
               [--notify-global-admins {Disabled, Enabled}]
               [--ntlm-v1 {Disabled, Enabled}]
               [--resource-forest {Disabled, Enabled}]
               [--sku {Enterprise, Premium, Standard}]
               [--sync-kerberos-pwd {Disabled, Enabled}]
               [--sync-ntlm-pwd {Disabled, Enabled}]
               [--sync-on-prem-pwd {Disabled, Enabled}]
               [--tls-v1 {Disabled, Enabled}]


az ad ds create --domain "" --replica-sets location="West US" subnet-id="<subnetId>" --name "" --resource-group "rg"

Best Practices for
Active Directory

Categorized by Availability, Security & Compliance and Cost

No items found.
Explore all the rules our platform covers
Related blog posts