I have decided to use Windows Azure as my lab environment because it is the fastest and most accessible way for me to work on this from anywhere in the world. I travel a lot so I want to be able to access the lab while on the road. This is a self-contained lab environment that for right now is just for my PowerShell learning. But it has the potential to be used for other lab scenarios and is completely expandable.

I am using the following book to teach myself more about PowerShell -

“Learn Windows PowerShell 3 In A Month Of Lunches” by Don Jones and Jeffery D. Hicks

I have decided to use Windows Azure as my lab environment because it is the fastest and most accessible way for me to work on this from anywhere in the world. I travel a lot so I want to be able to access the lab while on the road. This is a self-contained lab environment that for right now is just for my PowerShell learning. But it has the potential to be used for other lab scenarios and is completely expandable.

You can create your own Windows Azure Lab by following along. The first step is to get signed up for a Free Windows Azure Trial account here -

To create the lab environment, we have to build out a few different pieces -

Part 1 of 3 – Speed Build a Virtual Network

Part 2 of 3 - Create the base Virtual Machines (we will use 3 for our base lab)

Part 3 of 3 - Configure the Virtual Machines – One (1) Domain Controller and Two (2) Domain Joined Member Servers

Ongoing summary posts of what I learn as I read the book and learn more about PowerShell.

------------------------------------------------------------------------

Hopefully, if you are at the stage of wanting to learn PowerShell, you already know how to create a Windows Domain Controller. Even if you don’t have much experience with Windows Server 2012 R2 Preview, you should be able to stumble through this part easily. But there are a few configurations we need to look at to ensure all of the virtual machines can speak to each other.

Note - If you have not already created three (3) virtual machines, go back to Part 2 to review the steps for creating the additional virtual machines. We will need a total of three (3) for our lab. Once you have the required virtual machines, come back to this post to complete the configuration

*** Important *** – When creating the additional virtual machines, ensure they are all in the same Cloud Service, Virtual Network, and Storage Account. You can look at the configuration of the Virtual Machine we created in Part 2 to find this information

image

 

------------------------------------------------------------------------

Configure Domain Controller

------------------------------------------------------------------------

Hopefully, if you are at the stage of wanting to learn PowerShell, you already know how to create a Windows Domain Controller. Even if you don’t have much experience with Windows Server 2012 R2 Preview, you should be able to stumble through this part easily. But there are a few configurations we need to look at to ensure all of the virtual machines can speak to each other.

First, remember how we said it was important for that first VM we created to be named something that would help you identify it as a domain controller?  Find that machine in your Azure Management Portal – http://manage.windowsazure.com

Find the virtual machine and Connect to it from the tool bar at the bottom of the page.

image

image

 

Once connected and logged in, start the process of adding the Active Directory Domain Services Role. When the wizard gets to the page where we select the server we are going to add the role to, notice the IP address assigned to the server  - 10.0.0.4 -  This is the same IP address we designated as out DNS server in Part 1. This is important because we need all of the virtual machines in our lab to point to this DC/DNS server for name resolution so we can join them to the domain later on and of course for proper AD functionality.

 

image

 

For the rest of the wizard, we only have to select the Active Directory Domain Services Role without adding or removing or making any other changes in the wizard. However, in Windows Server 2012, the wizard does NOT actually promote the server to a DC. When the wizard completes, we still have to manually run DCPROMO. The server can be manually promoted after the yellow triangle appears in the top status bar. Click the triangle, then click the link to promote the server to a DC.

 

image

 

This launched the DCPROMO wizard, which again, should be pretty familiar to most people by now. There are no special configurations for our lab. But I would encourage you to do one thing.

At the end of the wizard, we will be presented with a summary page. Near the lower right is a button labeled “View Script”.

 

image

 

Clicking this button will open Notepad and display the PowerShell script that the wizard will run to perform DCPROMO. Since the goal is to build a lab for learning PowerShell, I recommend you save this notepad file out to an easy to find folder for later viewing. This script can be modified by changing the –DomainName and –DomainNetbiosName parameters to run DCPROMO on another machine where the AD Domain Services role wizard has already been run and thus create a new domain. Further mods could be made to have it add a new DC to an existing Forest, create child domains, etc.

Our first PowerShell script!!

 

image

 

Once you have saved the script, finish the DCPROMO wizard and reboot and reconnect to make sure all went well. Remember that this time when we connect, it is a DC some we will have to use DOMAIN\USER in the RDP connectoid to gain access to the server. Once you have verified all is well with the Domain Controller, move to the next step -

------------------------------------------------------------------------

Join Additional VM’s to the Domain

------------------------------------------------------------------------

Identify the first virtual machine you want to join to your newly created domain. Highlight it in the Windows Azure Portal, then click Connect on the toolbar at the bottom of the screen.

 

image

image

 

Once you are logged in, go to the System Properties and change the machine from a Workgroup to a Domain by providing the name of the domain we created earlier. If we have performed everything successfully, the machine will almost immediately show a success message that it has joined the domain.

image

Close the windows, reboot, and then you can reconnect to the virtual machine.  Again, we are now domain joined so logon with DOMAIN\USER.

We can lather, rinse, repeat to join the second virtual machine to the domain.

Now we have a small lab environment where we can play around without causing any damage to our production network!

*** Important *** - If you will not actively be using the virtual machines, be sure to shut down the VM’s so they do not use up time on your trial.  

Congratulations!  You now have your PowerShell Lab ready for testing and learning as well as some hands-on experience with Windows Azure!

 

The next series of blog posts will be summaries of my learning as I go through the PowerShell book I am reading (linked at the top of this blog post). I will try to summarize on a daily basis, but after thumbing through the book a little, I may be combining a few days together now and then. I also don’t plan to post on weekend, but there may be a few here and there.

 

 

-Cheers!