Skip to content

Commit d3db42e

Browse files
committed
Add AADC DSC config
1 parent ad156f2 commit d3db42e

3 files changed

Lines changed: 84 additions & 21 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1717
for `$script` scope variables.
1818
- Fixed sample `samples\Sample_WS2019_AzureADConnect.xml` default gateway
1919
for SA-AADC VM.
20+
- `dsclibrary\MEMBER_AADC.DSC.ps1`: Created DSC config for deploying an
21+
Azure AD Connect server.
2022

2123
## [1.1.0] - 2020-08-30
2224

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<###################################################################################################
2+
DSC Template Configuration File For use by LabBuilder
3+
.Title
4+
MEMBER_AADC
5+
.Desription
6+
Builds a Server that is joined to a domain and installs Azure Active Directory Connect on it.
7+
.Parameters:
8+
DomainName = 'LABBUILDER.COM'
9+
DomainAdminPassword = 'P@ssword!1'
10+
DCName = 'SA-DC1'
11+
PSDscAllowDomainUser = $true
12+
###################################################################################################>
13+
14+
Configuration MEMBER_AADC
15+
{
16+
Import-DscResource -ModuleName PSDesiredStateConfiguration
17+
Import-DscResource -ModuleName ComputerManagementDsc -ModuleVersion 7.1.0.0
18+
Import-DscResource -ModuleName xPSDesiredStateConfiguration -ModuleVersion 9.1.0
19+
20+
Node $AllNodes.NodeName {
21+
# Assemble the Local Admin Credentials
22+
if ($Node.LocalAdminPassword)
23+
{
24+
$LocalAdminCredential = New-Object `
25+
-TypeName System.Management.Automation.PSCredential `
26+
-ArgumentList ('Administrator', (ConvertTo-SecureString $Node.LocalAdminPassword -AsPlainText -Force))
27+
}
28+
29+
if ($Node.DomainAdminPassword)
30+
{
31+
$DomainAdminCredential = New-Object `
32+
-TypeName System.Management.Automation.PSCredential `
33+
-ArgumentList ("$($Node.DomainName)\Administrator", (ConvertTo-SecureString $Node.DomainAdminPassword -AsPlainText -Force))
34+
}
35+
36+
WaitForAll DC
37+
{
38+
ResourceName = '[ADDomain]PrimaryDC'
39+
NodeName = $Node.DCname
40+
RetryIntervalSec = 15
41+
RetryCount = 60
42+
}
43+
44+
Computer JoinDomain
45+
{
46+
Name = $Node.NodeName
47+
DomainName = $Node.DomainName
48+
Credential = $DomainAdminCredential
49+
DependsOn = '[WaitForAll]DC'
50+
}
51+
52+
xMsiPackage InstallAzureADConnect
53+
{
54+
ProductId = '{1454BE23-6C31-46DE-ABCB-A3FD413F98C9}'
55+
Path = 'https://download.microsoft.com/download/B/0/0/B00291D0-5A83-4DE7-86F5-980BC00DE05A/AzureADConnect.msi'
56+
Ensure = 'Present'
57+
}
58+
}
59+
}

source/samples/Sample_WS2019_AzureADConnect.xml

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@
6868
<vms>
6969
<vm name="SA-DC1"
7070
template="Template Windows Server 2019 Datacenter CORE"
71-
computername="SA-DC1">
71+
computername="SA-DC1"
72+
bootorder="1">
7273
<dsc configname="DC_FORESTPRIMARY"
7374
configfile="DC_FORESTPRIMARY.DSC.ps1">
7475
<parameters>
@@ -96,7 +97,8 @@
9697

9798
<vm name="SA-DHCP1"
9899
template="Template Windows Server 2019 Datacenter CORE"
99-
computername="SA-DHCP1">
100+
computername="SA-DHCP1"
101+
bootorder="2">
100102
<dsc configname="MEMBER_DHCP"
101103
configfile="MEMBER_DHCP.DSC.ps1">
102104
<parameters>
@@ -164,12 +166,12 @@
164166
</adapters>
165167
</vm>
166168

167-
<vm name="SA-AADC"
169+
<vm name="SA-EDGE1"
168170
template="Template Windows Server 2019 Datacenter Full"
169-
computername="SA-AADC"
171+
computername="SA-EDGE1"
170172
bootorder="3">
171-
<dsc configname="MEMBER_DEFAULT"
172-
configfile="MEMBER_DEFAULT.DSC.ps1">
173+
<dsc configname="MEMBER_REMOTEACCESS"
174+
configfile="MEMBER_REMOTEACCESS.DSC.ps1">
173175
<parameters>
174176
DomainName = "LABBUILDER.COM"
175177
DomainAdminPassword = "P@ssword!1"
@@ -180,24 +182,26 @@
180182
<adapters>
181183
<adapter name="Domain Private Site A"
182184
switchname="Domain Private Site A">
183-
<ipv4 address="192.168.128.17"
184-
defaultgateway="192.168.128.19"
185+
<ipv4 address="192.168.128.19"
186+
defaultgateway=""
185187
subnetmask="24"
186188
dnsserver="192.168.128.10"/>
187-
<ipv6 address="fd53:ccc5:895a:bc00::b"
188-
defaultgateway="fd53:ccc5:895a:bc00::13"
189+
<ipv6 address="fd53:ccc5:895a:bc00::13"
190+
defaultgateway=""
189191
subnetmask="64"
190192
dnsserver="fd53:ccc5:895a:bc00::a"/>
191193
</adapter>
194+
<adapter name="External"
195+
switchname="External" />
192196
</adapters>
193197
</vm>
194198

195-
<vm name="SA-EDGE1"
199+
<vm name="SA-AADC"
196200
template="Template Windows Server 2019 Datacenter Full"
197-
computername="SA-EDGE1"
198-
bootorder="3">
199-
<dsc configname="MEMBER_REMOTEACCESS"
200-
configfile="MEMBER_REMOTEACCESS.DSC.ps1">
201+
computername="SA-AADC"
202+
bootorder="4">
203+
<dsc configname="MEMBER_AADC"
204+
configfile="MEMBER_AADC.DSC.ps1">
201205
<parameters>
202206
DomainName = "LABBUILDER.COM"
203207
DomainAdminPassword = "P@ssword!1"
@@ -208,17 +212,15 @@
208212
<adapters>
209213
<adapter name="Domain Private Site A"
210214
switchname="Domain Private Site A">
211-
<ipv4 address="192.168.128.19"
212-
defaultgateway=""
215+
<ipv4 address="192.168.128.17"
216+
defaultgateway="192.168.128.19"
213217
subnetmask="24"
214218
dnsserver="192.168.128.10"/>
215-
<ipv6 address="fd53:ccc5:895a:bc00::13"
216-
defaultgateway=""
219+
<ipv6 address="fd53:ccc5:895a:bc00::b"
220+
defaultgateway="fd53:ccc5:895a:bc00::13"
217221
subnetmask="64"
218222
dnsserver="fd53:ccc5:895a:bc00::a"/>
219223
</adapter>
220-
<adapter name="External"
221-
switchname="External" />
222224
</adapters>
223225
</vm>
224226
</vms>

0 commit comments

Comments
 (0)