Create Network Security Groups (NSGs) for Active Directory in Azure with Terraform Blog --> https://gmusumeci.medium.com/how-to-configure-active-directory-network-security-groups-and-firewall-rules-in-azure-using-a08b59439033 How to use this code: Update dns_servers variable = Your existing or new Active Directory DNS servers Update dc_servers variable = Your cloud Active Directory Domain Controller servers Update ad_resource_group data variable to point to the Resource Group where we want to create the NSGs Terraform files active-directory-nsg-client = NSG to allow traffic from client to AD Domain Controllers active-directory-nsg-dc = NSG to allow traffic between AD Domain Controllers How To deploy the code: Clone the repo Update variables to your environment Execute "terraform init" Execute "terraform apply"