Skip to content

Instantly share code, notes, and snippets.

{
"type": "Microsoft.Compute/virtualMachines/extensions",
"name": "[concat(parameters('ADFS02VMName'),'/InstallADFS')]",
"apiVersion": "2015-05-01-preview",
"location": "[resourceGroup().location]",
"dependsOn": [
"[concat('Microsoft.Compute/virtualMachines/', parameters('ADFS02VMName'))]",
],
"properties": {
"publisher": "Microsoft.Powershell",
"repoLocation": "https://raw.githubusercontent.com/user/folder/",
"InstallADFSPackageURL": "[concat(parameters('repoLocation'), 'InstallADFS.zip')]",
"InstallADFSConfigurationFunction": "InstallADFS.ps1\\InstallADFS",
"AddToADFSFarmScriptUrl": "[concat(parameters('repoLocation'), 'AddToADFSFarm.ps1')]",
$localpath = "C:\Program Files\WindowsPowerShell\Modules\Certificates\"
$Key = (3,4,2,3,56,34,254,222,1,1,2,23,42,54,33,233,1,34,2,7,6,5,35,43)
@nivleshc
nivleshc / InstallWAP_Param.ps1
Created November 26, 2016 05:08
Parameter declaration for InstallWAP.ps1
Configuration InstallWAP
{
param
(
[string[]]$NodeName="localhost"
)
@nivleshc
nivleshc / InstallWAP_Node.ps1
Created November 26, 2016 05:13
Defines the Node structure for InstallWAP.ps1
Node $NodeName
{
LocalConfigurationManager
{
ActionAfterReboot = 'ContinueConfiguration'
ConfigurationMode = 'ApplyOnly'
RebootNodeIfNeeded = $true
}
@nivleshc
nivleshc / InstallWAP_InstallWAP_Role.ps1
Created November 29, 2016 06:45
Part of the InstallWAP.ps1 which installs the WAP role
WindowsFeature InstallWAP #install WAP Role
{
Ensure = "Present"
Name = "Web-Application-Proxy"
}
@nivleshc
nivleshc / InstallWAP.ps1
Created November 29, 2016 06:51
Installs the Web Application Proxy Role using DSC
Configuration InstallWAP
{
param
(
[string[]]$NodeName="localhost"
)
Node $NodeName
{
LocalConfigurationManager
@nivleshc
nivleshc / ConfigureWAP_DefineVariables.ps1
Created November 29, 2016 10:51
Define Variables for ConfigureWAP.ps1
<#
ConfigureWAP.ps1 is passed the username for an account that has local administrator access on the ADFS Server
#>
param
(
$AdminUsername
)
#password for the local administrator account on the ADFS server is encrypted and stored in a local folder
#define the directory where the files are stored and the key used to encrypt the password, so that the password
@nivleshc
nivleshc / ConfigureWAP_ReadCredentials.ps1
Created November 29, 2016 10:57
Read in Credentials in the ConfigureWAP.ps1 script
#read in the contents of the file containing the encypted password for the account with local administrator
#access on the ADFS Server, and decrypt the password using the key
$adminpassword = Convertto-SecureString -String (Get-Content -Path $($localpath+"adminpass.key")) -key $key
#Create a PSCredential Object using the account username and password
$AdminCreds = New-Object System.Management.Automation.PSCredential($($AdminUsername), $adminpassword)
@nivleshc
nivleshc / ConfigureWAP_ImportCert_ConfigureWAP.ps1
Created November 29, 2016 11:00
Imports the Certificate used to create the ADFS Farm and then configure WAP
#import the certificate that was used to create the ADFS Farm
Import-PfxCertificate -Exportable -Password $adminpassword -CertStoreLocation cert:\localmachine\my -FilePath $($localpath+"fs.adfsfarm.com.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"}
Install-WebApplicationProxy -FederationServiceName fs.adfsfarm.com -FederationServiceTrustCredential $AdminCreds -CertificateThumbprint $cert.thumbprint