Build Domain Controller with AD Tenant in 60 minutes – Azure

 “Infrastructure as code” true power of Microsoft Azure Cloud. Here I sketched a single file use to Install a domain controller in Microsoft Azure with provision of an Azure AD Tenant. You need to define all parameters first. All AD Groups, AD Test users, AD Members and AD OUs are present in attached .csv files. I passed the example parameters in script. Script will do following in sequence shown below based on your parameters
·        Storage Account
·        Virtual Network and Subnet
·        Cloud Service
·        Virtual Machine
·        Domain and Tenant
Since i am in New Zealand so, i mentioned my closest Microsoft data center location “Australia East” in script everywhere. Place all files in one folder for example in my case all files residing at location in folder C:\DC\
DC is folder name here, all files with given below names are attached
File to create domain controller: DomainController.ps1
File to create VNet and Subnet: CreateVNetSubNet.xml
File to create AD Groups: AD_Groups.csv
File to create AD members: AD_Members.csv
File to create AD OUs: AD_OUs.csv
File to create AD Users: AD_Users.csv

Click here to download all files.

Here are steps to execute scrip with mentioned files.
1. Open PowerShell ISE with Administrator Account 
2. Add-Azure Account as shown below

3. Pass Azure Account Credentials in prompt window

4. Run command Get-AzureSubscription in order to see subscription is valid or not
5. Select the DomainController.ps1 from location C:\DC\ and open in PowerShell

6. Run the script and it will look like below, note script is start executing in sequence
7. Here you can see the progress

8. After completion of above following will be created
9. Click on VM i.e “MyTestVMforAD”

10. Press “Connect” to take session

11. After log-in, go to server administrative tools and click “Active Directory Users and Computers”

12. WOW, domain controller has been provisioned and users imported 🙂

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at

Up ↑

%d bloggers like this: