This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"type": "Microsoft.Compute/virtualMachines/extensions", | |
"name": "[concat(parameters('ADFS01VMName'),'/ConfigureADFS')]", | |
"apiVersion": "2015-05-01-preview", | |
"location": "[resourceGroup().location]", | |
"dependsOn": [ | |
"[concat('Microsoft.Compute/virtualMachines/', parameters('ADFS01VMName'))]", | |
"[concat('Microsoft.Compute/virtualMachines/', parameters('ADFS01VMName'),'/extensions/InstallADFS')]" | |
], | |
"properties": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[System.Management.Automation.PSCredential]$DomainCreds = New-Object System.Management.Automation.PSCredential ("${DomainName}\$($Admincreds.UserName)", $Admincreds.Password |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xWaitForADDomain DscForestWait | |
{ | |
DomainName = $DomainName | |
DomainUserCredential= $DomainCreds | |
RetryCount = $RetryCount | |
RetryIntervalSec = $RetryIntervalSec | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LocalConfigurationManager | |
{ | |
ActionAfterReboot = 'ContinueConfiguration' | |
ConfigurationMode = 'ApplyOnly' | |
RebootNodeIfNeeded = $true | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"domainName": { | |
"type": "string", | |
"metadata": { | |
"description": "The FQDN of the AD Domain created " | |
} | |
}, | |
"adminUsername": { | |
"type": "string", | |
"metadata": { | |
"description": "The name of the Administrator of the new VM and Domain" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$AdminSecurePassword = ConvertTo-SecureString {AdminPlainTextPassword} -AsPlainText -Force | |
ConvertFrom-SecureString $AdminSecurePassword -Key $key > adminpass.key | |
$ADFSSecurePassword = ConvertTo-SecureString {ADFSPlainTextPassword} -AsPlainText -Force | |
ConvertFrom-SecureString $ADFSSecurePassword -Key $key > adfspass.key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$adfspassword = Convertto-SecureString -String (Get-Content -Path $($localpath+"adfspass.key")) -key $key | |
$AdfsSvcCreds = New-Object System.Management.Automation.PSCredential($($DomainName+"\"+$AdfsSvcUsername), $adfspassword) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#install the certificate that will be used for ADFS Service | |
Import-PfxCertificate -Exportable -Password $adfspassword -CertStoreLocation cert:\localmachine\my -FilePath $($localpath+"adfs_certificate.pfx") | |
#get thumbprint of certificate | |
$cert = Get-ChildItem -Path Cert:\LocalMachine\my | ?{$_.Subject -eq "CN=fs.adfsfarm.com, OU=Free SSL, OU=Domain Control Validated"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Configure ADFS | |
Import-Module ADFS | |
Add-AdfsFarmNode -CertificateThumbprint $cert.thumbprint -ServiceAccountCredential $AdfsSvcCreds -PrimaryComputerName $PrimaryADFSServer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<#AddToADFSFarm.ps1 | |
#> | |
param ( | |
$DomainName, | |
$PrimaryADFSServer, | |
$AdfsSvcUsername | |
) | |
#the adfs service account password is encrypted and stored in a local folder | |
$localpath = "C:\Program Files\WindowsPowerShell\Modules\Certificates\" |