forked from robotechredmond/Azure-PowerShell-Snippets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
aa-dsc-config-sample-replica-dc.ps1
38 lines (30 loc) · 1.1 KB
/
aa-dsc-config-sample-replica-dc.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Configuration ReplicaDC {
param
(
[Parameter(Mandatory)]
[String]$DomainName
)
Import-DscResource -ModuleName xActiveDirectory
$AdminCreds = Get-AutomationPSCredential -Name "aa-credential-asset-name"
Node $AllNodes.Localhost {
WindowsFeature InstallADDS {
Ensure = "Present"
Name = "AD-Domain-Services"
}
xADDomainController ReplicaDC {
DomainName = $DomainName
DomainAdministratorCredential = $AdminCreds
}
}
}
$Params = @{"DomainName"="contoso.com"}
# Note that PSDscAllowPlainTextPassword does not present security issue, because Azure Automation encrypts the compiled MOF itself.
$ConfigData = @{
AllNodes = @(
@{
NodeName = "*"
PSDscAllowPlainTextPassword = $True
}
)
}
Start-AzureRmAutomationDscCompilationJob -ResourceGroupName "rg01" -AutomationAccountName "auto01" -ConfigurationName "ReplicaDC" -Parameters $Params -ConfigurationData $ConfigData