Our domain controller lets us scale the lab more easily.
Now that we have one, we can use it to configure user accounts and assign DHCP leases,
so adding a new machine to the network is very easy.
Creating AD user accounts
Creating the accounts themselves are very easy.
One potentially surprising behavior in the configuration as we’ve written it here is that
it uses the local admin password for the password of the user1 user also.
Of course, you could pass in a different password instead,
but for a disposable lab like this one,
using the same password is unlikely to cause any security problems.
Once the account is created, it can be used to log on to any machine in the domain,
and since the user1 account is a member of both Domain Admins and Enterprise Admins,
that account will have administrative privileges on all VMs in the domain and over the domain itself.
Use DHCP for clients, and static IP addresses for servers
You may notice that we wrap the networking configuration in an if statement:
This lets us apply that node block to all machines on the network except the gateway,
but only configure manual networking if a static IP address was defined in the configuration data.
(If networking is not configured manually, Windows will use DHCP to try to obtain a configuration.)
Windows event forwarding
Now that we have a domain, we can easily enable Windows event forwarding.
This can be very helpful when debugging problems with labs consisting of multiple VMs,
because (assuming the event forwarding configuration gets applied)
you should only need to log on to the VM where the events are being forwarded
in order to see the logs from any other VM.
If you are in the target audience for this tutorial,
you probably know that there are dozens of logging solutions available.
We choose WEF in this chapter because it is agentless and supported out of the box.
In fact, it’s supported all the way back to Windows XP SP2 / Server 2003 SP1.
TODO: Finish this section
Adding event source subscriptions
See the Query setting in the xWEFSubscription DSC resource in our configuration.
By default, that looks like this:
These go in to the Windows event subscription XML something like:
One thing that may not be obvious is that events can actually be filtered from these sources -
for instance, by replacing the * with *[System[EventId=2]],
you can ignore all events with an EventId other than 2.
It may be useful to see examples from other organizations.
How to set event log security locally or by using Group Policy -
I believe this will help define the registry keys that the group policy objects create for you
(and we can’t use GPO in DSC because there’s no way to save GPO objects or import them into a new domain,
you have to use the GUI).
Note how the new, complicated functionality of creating and joining the AD domain
is not configured until basic networking is configured.
Keeping networking as early in the configuration as possible,
and certainly before new, untested functionality,
ensures you will be able to log in via PS Remoting
if something were to go wrong with the new functionality in the configuration.
Lab exercises and files
Add more users via active directory
Change the CORPNET Hyper-V switch to “internal” instead of “private”.
Redeploy, then see if you notice any network problems from your host.
What problems are you seeing? Why are they manifesting?
(Once finished, delete the CORPNET internal Hyper-V switch,
and any problems you were seeing should dissipate.)
Log on to the domain controller and view Windows events forwarded from the other machines.
Collect more logs, perhaps WinRM logs from
Applications and Services Logs\Microsoft\Windows\Windows Remote Management,
then redeploy the lab, log on to the domain controller, and view the newly forwarded events.
Advanced/bonus exercise:
Follow the Microsoft Advanced Threat Analytics deploy instructions
to deploy MS ATA to your lab using the GUI.
MS ATA uses Windows Event Forwarding and is a good real-world use case for this functionality.
Follow-up bonus:
automate the installation by adding an ATA Lability resource
and install ATA using Powershell DSC.