ADFSValidation/Microsoft.AzureStack.ADFSValidation.psm1

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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
function Invoke-AzsADFSValidation {
    <#
    .SYNOPSIS
        Performs ADFS Validation before DC Integration with Azure Stack
    .DESCRIPTION
        A tool that can be run standalone or as part ADFS integration for Azure Stack.
        Gives operators pre-validation before attempting integration, to ensure all prerequisites are met.
        Calls into ADFS functions to provide validation of readiness for ADFS integration.
        Validates:
            ADFS Metadata - Can download metadata for validation, or accept an offline metadata file.
            ADFS SSL Certificate - Retrieves SSL cert, and builds chain of trust. (On Stamp ADFS must trust this certificate's chain)
            ADFS Signing Certificate - Retrieves Signing Certificate, checks expiry and build chain of trust.
    .EXAMPLE
        PS C:\> Invoke-AzsADFSValidation -CustomADFSFederationMetadataEndpointUri https://adfs.contoso.com/FederationMetadata/2007-06/FederationMetadata.xml
        Retrieves Federation Metadata XML from host name provided.
    .EXAMPLE
        PS C:\> Invoke-WebRequest "https://adfs.contoso.com/FederationMetadata/2007-06/FederationMetadata.xml" -OutFile "data.xml"
        PS C:\> Invoke-AzsADFSValidation -MetaDataFile data.xml
        Reads federation meta data from data.xml
    .PARAMETER CustomADFSFederationMetadataEndpointUri
        WellFormedUriString - URL to FederatedMetaData.xml e.g. https://adfs.contoso.com/FederationMetadata/2007-06/FederationMetadata.xml
    .PARAMETER MetaDataFile
        string - path to ADFS meta data file
    .PARAMETER ExpiringInDays
        int - optional value in days to warn for expiring certificates (default is 60 days)
    .PARAMETER ForceTLS12
        Force the use of TLS 1.2, true by default
    .PARAMETER OutputPath
        Specifies custom path to save Readiness JSON report and Verbose log file.
    .PARAMETER CleanReport
        Specifies whether to purge the existing report and start again with a clean report. Execution history and validation data is lost for all Readiness Checker validations.
    .PARAMETER PassThru
        switch - Return output results PSObject
    .OUTPUTS
        Output (if any)
    .NOTES
        ADFS Integration - https://aka.ms/AzsADFSIntegration
    #>

    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $true, HelpMessage = "Enter ADFS FQDN", ParameterSetName = "ValidateADFS")]
        [ValidateScript( {[system.uri]::IsWellFormedUriString($_,[System.UriKind]::Absolute) -and $_.split('.')[-1] -eq 'xml' <#must be valid URL to meta data xml#>})]
        [string]
        $CustomADFSFederationMetadataEndpointUri,
        
        [Parameter(Mandatory = $true, HelpMessage = "Enter Path to ADFS Metadata XML file", ParameterSetName = "ValidateADFSOffline")]
        [ValidateScript( {Test-Path $_ -Include *.xml <#MetaDataFile must be a valid xml file#>})]
        [string]
        $MetaDataFile,

        [Parameter(Mandatory = $false, HelpMessage = "Provide number of days (default 60) warning for expiring certificates.")]
        [int]
        $ExpiringInDays = 60,
        
        [Parameter(Mandatory=$false,HelpMessage="Force the use of TLS 1.2, true by default")]
        [bool]$ForceTLS12 = $true,
        
        [Parameter(HelpMessage = "Directory path for log and report output")]
        [string]$OutputPath = "$ENV:TEMP\AzsReadinessChecker",
            
        [Parameter(HelpMessage = "Remove all previous progress and create a clean report")]
        [switch]$CleanReport = $false,
        
        [Parameter(Mandatory = $false, HelpMessage = "Return output results PSObject")]
        [switch]
        $PassThru
    )
    try {
        $thisFunction = $MyInvocation.MyCommand.Name
        $GLOBAL:OutputPath = $OutputPath
        Import-Module $PSScriptRoot\..\Microsoft.AzureStack.ReadinessChecker.Reporting.psm1 -Force

        # Import localization strings
        Import-LocalizedData LocalizedData -BaseDirectory $PSScriptRoot -Filename Microsoft.AzureStack.ADFSValidation.Strings.psd1
        
        # Load helper Modules
        Import-Module $PSScriptRoot\..\Microsoft.AzureStack.ReadinessChecker.Utilities.psm1 -Force
         
        Write-Header -invocation $MyInvocation -params $PSBoundParameters

        # detect if this is on ercs machine or standalone.
        if ($ENV:COMPUTERNAME -notlike '*-ercs0') {
            $standalone = $true
            Write-AzsReadinessLog ("Running in standalone/offstamp mode") -Type Info -Function $thisFunction
        }

        # Get/Clean Existing Report
        $readinessReport = Get-AzsReadinessProgress -clean:$CleanReport
        $readinessReport = Add-AzsReadinessCheckerJob -report $readinessReport
        
        # Force Security Profile to TLS1.2
        if ($ForceTLS12)
        {
            # Change Security Protocol to TLS1.2 for the session and track for clean up later.
            $restoreSecurityProtocol = [Net.ServicePointManager]::SecurityProtocol
            $tempSecurityProtocol = [Net.SecurityProtocolType]::Tls12
            Set-SecurityProtocol -securityProtocol $tempSecurityProtocol
        }

        # Start Checks
        $results = @()
        if ($PSCmdlet.ParameterSetName -eq 'ValidateADFS') {
            # Retrieve metadata and SSL certificate online
            Write-Host ("Testing ADFS Endpoint {0}" -f $CustomADFSFederationMetadataEndpointUri)
            $metaDataResult = Get-ADFSMetaData -CustomADFSFederationMetadataEndpointUri $CustomADFSFederationMetadataEndpointUri
            $metaData = $metaDataResult.outputObject
            $metaDataResult.outputObject = $null
            $results += $metaDataResult
            if ($metaData){
                $sslCertificate = Get-AdfsSslCertificate -sslEndPoint $CustomADFSFederationMetadataEndpointUri
                $validateSslCertificateChain = Test-CertificateChain -cert $sslCertificate
                $validateSslCertificateChain.Test = 'Test SSL ADFS Certificate'
                $results += $validateSslCertificateChain
                # write result to screen later after metadata validation
            }
        }
        
        if ($PSCmdlet.ParameterSetName -eq 'ValidateADFSOffline') {
            # Parse metadata XML
            Write-Host ("Testing ADFS Meta data file {0} (offline)" -f $MetaDataFile)
            $metaDataResult = Get-ADFSMetaData -MetaDataFile $MetaDataFile
            $metaData = $metaDataResult.outputObject
            $metaDataResult.outputObject = $null
            $results += $metaDataResult
        }
        
        Write-Result -in $metaDataResult
        if (-not $metaData) {
            throw "No valid metadata unable to continue."
        }

        # Validate Metadata as per install code
        $validateMetaDataResult = Test-FederationMetadataXml -FederationMetadataXml $metaData
        Write-Result -in $validateMetaDataResult
        $results += $validateMetaDataResult

        # Write SSL Chain result to screen if it exists (online scenario)
        if ($validateSslCertificateChain)
        {
            Write-Result -in $validateSslCertificateChain
        }

        # Get Certificates from metadata, currently only getting signing, but there could be multiple.
        $certificates = Get-ADFSCertificate -metaData $metaData -type Signing
        if (-not $certificates) {
            throw "Unable to retrieve certificates from ADFS MetaData"
        }

        # this would need to handle multiple certificates, not only per type but during cert rollover.
        $chains = @()
        foreach ($certificate in $certificates) {
            if ($certificate.Subject -eq $certificate.Issuer) {
                Write-AzsReadinessLog -Message ($LocalizedData.ChainCheckSkipped -f ($certificate | Get-ThumbprintMask)) -Type Info -Function $thisFunction
                $SkippedCertificateChain = New-Object PSObject -Property @{'Test' = 'Test Signing Certificate Chain'; 'Result' = 'Skipped'; 'FailureDetail' = $LocalizedData.ChainCheckSkipped -f ($certificate | Get-ThumbprintMask); 'outputObject' = $null}
                Write-Result -in $SkippedCertificateChain
                $results += $SkippedCertificateChain
            }
            else {
                $validateCertificateChain = Test-CertificateChain -cert $certificate
                Write-Result -in $validateCertificateChain
                $results += $validateCertificateChain
                $chains += $validateCertificateChain.outputObject
            }
            $certificateExpiryResult = Test-CertificateExpiry -cert $certificate -ExpiringInDays $ExpiringInDays
            Write-Result -in $certificateExpiryResult
            $results += $certificateExpiryResult
        }
    
        if ($standalone) {
        # Add warning to consider the standalone scenario is not fully indicative of a pass/fail for connectivity, chains of trust and the likes.
        $hash = @{'Test' = 'Standalone'; 'Result' = 'Warning'; 'FailureDetail' = $LocalizedData.StandaloneWarning; 'outputObject' = $null}
        $object = New-Object PSObject -Property $hash
        $results += $object
        }
    }
    catch{
        Write-AzsReadinessLog -Message ($LocalizedData.TestFailed -f $thisFunction, $_.exception.message) -Type Error -Function $thisFunction -toScreen
    }
    finally {
        if ($results.result -match "Fail|Warning" -or $standalone) {
            Write-Result -in $results.failureDetail
        }
        
        # Write results to readiness report
        $readinessReport.ADFSValidation = $results
        $readinessReport = Close-AzsReadinessCheckerJob -report $readinessReport
        Write-AzsReadinessProgress -report $readinessReport
        Write-AzsReadinessReport -report $readinessReport
        
        if ($ForceTLS12)
        {
            Set-SecurityProtocol -securityProtocol $restoreSecurityProtocol
        }
    
        Write-Footer -invocation $MyInvocation
    
        if ($PassThru){
            Write-Output $results
        }
    }
}

function Get-ADFSMetaData {
    <#
    .SYNOPSIS
        Gets ADFS Meta Data from URI or File
    .DESCRIPTION
        Gets ADFS Meta Data from URI or File
    .EXAMPLE
        PS C:\> Get-ADFSMetaData -CustomADFSFederationMetadataEndpointUri $CustomADFSFederationMetadataEndpointUri
        Retrieves Meta Data from online from URI
    .EXAMPLE
        PS C:\> Get-ADFSMetaData -MetaDataFile $MetaDataFile
        Reads Meta Data from offline from file
    .PARAMETER CustomADFSFederationMetadataEndpointUri
        URL for FederationMetaData.xml
    .PARAMETER MetaDataFile
        string - path to ADFS meta data file
    .OUTPUTS
        Pass/fail result
    .NOTES
        General notes
    #>

    param (
        [Parameter(Mandatory = $true, ParameterSetName = "OnlineMetadata")]
        [string]$CustomADFSFederationMetadataEndpointUri,
        [Parameter(Mandatory = $true, ParameterSetName = "OfflineMetadata")]
        $MetaDataFile
    )
    $thisFunction = $MyInvocation.MyCommand.Name
    $test = 'Read Metadata'
    if ($PSCmdlet.ParameterSetName -match 'OnlineMetadata') {
        try {
            Write-AzsReadinessLog ("Reading metadata uri {0}." -f $CustomADFSFederationMetadataEndpointUri) -Type Info -Function $thisFunction
            [xml]$metaData = Invoke-WebRequest -Uri $CustomADFSFederationMetadataEndpointUri -UseBasicParsing
            Write-AzsReadinessLog ("Successfully retrieved metadata from {0}." -f $CustomADFSFederationMetadataEndpointUri) -Type Info -Function $thisFunction
            $result = 'OK'
        }
        catch {
            $result = 'Fail'
            $failureDetail = $localizedData.TestFailed -f $thisFunction, $_.exception
            Write-AzsReadinessLog $failureDetail -Type Error -Function $thisFunction
        }
    }
    
    if ($PSCmdlet.ParameterSetName -match 'OfflineMetadata') {
        try {
            Write-AzsReadinessLog ("Reading metadata file {0}." -f $MetaDataFile) -Type Info -Function $thisFunction
            [xml]$metaData = Get-Content $MetaDataFile
            $result = 'OK'
            Write-AzsReadinessLog ("Successfully read metadata file {0}." -f $MetaDataFile) -Type Info -Function $thisFunction
            
        }
        catch {
            $result = 'Fail'
            $failureDetail = $localizedData.FailedMetadataFileProcessing -f $metaDataFile, $_.exception
            Write-AzsReadinessLog $failureDetail -Type Error -Function $thisFunction
        }
    }
    $hash = @{'Test' = $test; 'Result' = $result; 'FailureDetail' = $failureDetail; 'outputObject' = $metaData}
    $object = New-Object PSObject -Property $hash
    $object
}

function Test-FederationMetadataXml {
    <#
    .SYNOPSIS
        Validate FederationMetaData
    .DESCRIPTION
        Validate FederationMetaData has EntityDescriptor > EntityId, RoleDescriptor, Signature
    .EXAMPLE
        PS C:\> Test-FederationMetadataXml -FederationMetadataXml $metaData
        Performance validate described above
    .OUTPUTS
        Pass/fail result
    .NOTES
        General notes
    #>

    param ([xml]$FederationMetadataXml)
    
    $thisFunction = $MyInvocation.MyCommand.Name
    $test = 'Test Metadata Elements'
    $failureDetail = @()

    Write-AzsReadinessLog -Message "Testing Metadata elements." -Type Info -Function $thisFunction

    try {
        if ($null -eq $FederationMetadataXml) {
            $failureDetail += $localizedData.MetaDataNotValidXML
        }
 
        if ($null -eq $FederationMetadataXml.EntityDescriptor) {
            $failureDetail += $localizedData.MetaDataNoEntityDescriptor
        }
 
        if ($null -eq $FederationMetadataXml.EntityDescriptor.EntityId) {
            $failureDetail += $localizedData.MetaDataNoRoleEntityId
        }
 
        if ($null -eq $FederationMetadataXml.EntityDescriptor.RoleDescriptor) {
            $failureDetail += $localizedData.MetaDataNoRoleDescriptor
        }
 
        if ($null -eq $FederationMetadataXml.EntityDescriptor.Signature) {
            $failureDetail += $localizedData.MetaDataNoSignature
        }
        
        if ($failureDetail) {
            $result = 'Fail'
            Write-AzsReadinessLog ('{0}' -f ($failureDetail -join '. ')) -Type Error -Function $thisFunction
        }
        else {
            $result = 'OK'
            Write-AzsReadinessLog 'All expected data elements exist.' -Type Info -Function $thisFunction
        }
    }
    catch {
        $failureDetail = $localizedData.TestFailed -f $test, $_.exception
        Write-AzsReadinessLog -Message $failureDetail -Type Error -Function $thisFunction
    }
    $hash = @{'Test' = $test; 'Result' = $result; 'FailureDetail' = $failureDetail; 'outputObject' = $null}
    $object = New-Object PSObject -Property $hash
    $object
}

function Test-CertificateChain {
    # on stamp only operation (help:https://aka.ms/AzsADFSIntegrationOffline)
    #Function to test certificate chain, will retry (configurable) 3 times with (configurable) 5 seconds intervals
    param ([System.Security.Cryptography.X509Certificates.X509Certificate2]$cert, [int]$retryCount = 3, [int]$intervalSeconds = 5 )
    $thisFunction = $MyInvocation.MyCommand.Name
    $test = 'Test Certificate Chain'
    
    Write-AzsReadinessLog -Message ('Testing Chain Trust for {0}' -f ($cert | Get-ThumbprintMask)) -Type Info -Function $thisFunction

    try {
        $chain = New-Object Security.Cryptography.X509Certificates.X509Chain

        # All failures (inc CRL failures) are blockers.
        do {
            $chainResult = $chain.build($cert)
            $chainFailureReasons = $chain.ChainStatus.status
            $retry++
            #sleep if unsuccessful and none CRL error present
            if (-not $chainResult -AND $retry -lt $retryCount -AND $chainFailureReasons) {
                Write-AzsReadinessLog -Message ($localizedData.ChainCheckRetry -f ($chainFailureReasons -join ','), $retry) -Type Warning -Function $thisfunction
                start-Sleep -Seconds $intervalSeconds
            }
        }
        while (-not $chainResult -AND $retry -le $retryCount) 
        
        # write chain elements to log
        if ($chain.ChainElements) {
            Write-AzsReadinessLog -Message "Chain Elements:" -Type Info -Function $thisfunction
            foreach ($element in $chain.ChainElements) {
                Write-AzsReadinessLog -Message ($element.certificate.psobject.properties | ForEach-Object {'{0} = {1}; ' -f $PSITEM.Name, $PSITEM.Value}) -Type Info -Function $thisFunction
                if ($element.chainstatus) {
                    Write-AzsReadinessLog -Message ("Chain Status: {0}" -f $element.chainstatus -join '. ' ) -Type Warning -Function $thisFunction
                }
            }
        }

        #Interpret result
        if ($chainResult) {
            Write-AzsReadinessLog -Message ($localizedData.ChainCheckSuccess -f ($cert | Get-ThumbprintMask)) -Type Info -Function $thisfunction
            $result = 'OK'
        }
        else {
            Write-AzsReadinessLog -Message ($localizedData.ChainCheckFailed -f ($cert | Get-ThumbprintMask), ($chainFailureReasons -join ',')) -Type Warning -Function $thisfunction
            $failureDetail = $chain.ChainStatus.StatusInformation.Trim("`n") -join ''
            $result = 'Fail'
        }
    }
    catch {
        $result = 'Fail'
        $failureDetail = ($localizedData.TestFailed -f $test, $_.exception)
        Write-AzsReadinessLog -Message $failureDetail -Type Error -Function $thisFunction
    }
    finally {
        if ($chain) {
            $chain.Dispose()
        }
    }
    $hash = @{'Result' = $result; 'test' = $test; 'failuredetail' = $failureDetail; 'outputObject' = $chain}
    $object = New-Object PSObject -Property $hash
    $object
}

function Get-ThumbprintMask {
    [cmdletbinding()]
    [OutputType([string])]
    Param ([Parameter(ValueFromPipelinebyPropertyName = $True)]$thumbprint)
    Begin {
        $thumbprintMasks = @()
    }
    Process {
        $thumbprintMasks += foreach ($thumb in $thumbprint) {
            try {
                if (($thumb.length - 12) -gt 0) {
                    $firstSix = $thumb.Substring(0, 6)
                    $lastSix = $thumb.Substring(($thumb.length - 6), 6)
                    $middleN = '*' * ($thumb.length - 12)
                    $thumbprintMask = '{0}{1}{2}' -f $firstSix, $middleN, $lastSix
                }
                else {
                    throw ("Error applying thumbprint mask from thumbprint starting with {0} and length of {1}" -f $thumbprint.Substring(0, 10), $thumbprint.Length)
                }

            }
            catch {
                $_.exception
            }
            $thumbprintMask
        }
    }
    End {
        $thumbprintMasks -join ','
    }
}

function Get-ADFSCertificate {
    <#
    .SYNOPSIS
        Retrieves Certificates from metadata
    .DESCRIPTION
        Retrieves Certificates from metadata
    .EXAMPLE
        PS C:\> Get-ADFSCertificate -type Signing -metadata $metadata
        Retrieves Signing Certificates from metadata
    .INPUTS
        Metadata
        Certificate Type (currently only Signing is valid)
    .OUTPUTS
        Certificate(s)
    #>


    [CmdletBinding()]
    param (
        $metaData, 
        [ValidateSet('Signing')]
        [string[]]$type
    )

    $thisFunction = $MyInvocation.MyCommand.Name

    Write-AzsReadinessLog -Message ('Reading certificate from metadata') -Type Info -Function $thisFunction
    $STSCerts = ($metaData.EntityDescriptor.RoleDescriptor | Where-Object type -eq "fed:SecurityTokenServiceType").keydescriptor | `
        Where-Object use -in $type | `
        ForEach-Object {$_.keyinfo.x509data.X509Certificate}

    #Decode each cert stored in metadata
    $STSCertficates = @()
    foreach ($STSCert in $STSCerts) {
        $decodedCert = [System.Convert]::FromBase64String($STSCert)
        [System.Security.Cryptography.X509Certificates.X509Certificate2]$STSObj = $decodedCert
        $STSCertficates += $STSObj
        Write-AzsReadinessLog -Message ('Read certificate {0} from metadata' -f ($STSObj | Get-ThumbprintMask)) -Type Info -Function $thisFunction
        Write-AzsReadinessLog -Message ($STSObj.psobject.properties | ForEach-Object {'{0} = {1}; ' -f $_.Name, $_.Value}) -Type Info -Function $thisFunction
    }
    $STSCertficates
}

function Get-AdfsSslCertificate {
    <#
    .SYNOPSIS
        Retrieve ADFS SSL Certificate
    .DESCRIPTION
        Create TLS connection to retrieve SSL certificate for ADFS endpoint
    .EXAMPLE
        PS C:\> Get-AdfsSSLCertificate -sslEndPoint https://sts.contoso.com
        Create TLS connection to retrieve SSL certificate for ADFS endpoint
    .INPUTS
        URI
    .OUTPUTS
        x509Certificate2
    #>


    param([System.Uri]$sslEndPoint)
    
    $thisFunction = $MyInvocation.MyCommand.Name
    Write-AzsReadinessLog -Message ('Retrieving SSL certificate from URI {0}' -f $uri) -Type Info -Function $thisFunction

    #try and retrieve certificate inventory from SSL endpoint
    try {
        $null = Invoke-WebRequest $SSLEndPoint -UseBasicParsing -TimeoutSec 3
        $servicePoint = [System.Net.ServicePointManager]::FindServicePoint($SSLEndPoint)
        [System.Security.Cryptography.X509Certificates.X509Certificate2]$sslCert = $servicePoint.Certificate
    }
    catch {
        $failureDetail = ($localizedData.TestFailed -f $thisFunction, $_.exception)
        Write-AzsReadinessLog -Message $failureDetail -Type Error -Function $thisFunction
    }
    $sslCert
}

function Test-CertificateExpiry {
    param ([System.Security.Cryptography.X509Certificates.X509Certificate2]$cert, $ExpiringInDays = 60)

    $thisFunction = $MyInvocation.MyCommand.Name
    $test = 'Test Certificate Expiry'

    $certificateExpiryDate = $cert.NotAfter
    $certificateExpiryToleranceDate = [DateTime]::Now.AddDays($ExpiringInDays)
    # default rollover helpers
    $SampleCertificateGenerationDate = $certificateExpiryDate.AddDays(-20)
    $SampleCertificatePromotionDate = $SampleCertificateGenerationDate.AddDays(5)

    Write-AzsReadinessLog -Message ('Reading certificate {0} expiry date {1}' -f ($cert | Get-ThumbprintMask),$certificateExpiryDate) -Type Info -Function $thisFunction

    if ($certificateExpiryToleranceDate -gt $certificateExpiryDate) {
        $result = 'Warning'
        $failureDetail = $localizedData.CertificateExpiry -f ($cert | Get-ThumbprintMask), $certificateExpiryDate, $SampleCertificateGenerationDate, $SampleCertificatePromotionDate
        Write-AzsReadinessLog -Message $failureDetail -Type Warning -Function $thisFunction
    }
    else {
        $result = 'OK'
        Write-AzsReadinessLog -Message ('Certificate {0} expiry date {1} within tolerance.' -f ($cert | Get-ThumbprintMask),$certificateExpiryDate) -Type Info -Function $thisFunction
    }
    $hash = @{'Result' = $result; 'test' = $test; 'failuredetail' = $failureDetail; 'outputObject' = $chain}
    $object = New-Object PSObject -Property $hash
    $object
}

function Write-Result {
    param([psobject]$in)
    if ($in.test) {
        Write-Host ("`t{0}: " -f $in.Test).PadRight(40) -noNewLine
        if ($in.Result -eq 'OK') {
            Write-Host 'OK' -foregroundcolor Green
        }
        elseif ($in.Result -eq 'WARNING') {
            Write-Host 'Warning' -foregroundcolor Yellow
        }
        elseif ($in.Result -eq 'Skipped') {
            Write-Host 'Skipped' -foregroundcolor White
        }
        else {
            Write-Host 'Fail' -foregroundcolor Red
        }
    }
    else {
        Write-Host "`Details:"
        $in | ForEach-Object {if ($_) {Write-Host "[-] $_" -foregroundcolor Yellow}}
        Write-Host ("Additional help URL: {0}" -f "https://aka.ms/AzsADFSIntegration") 
    }
}
# SIG # Begin signature block
# MIIjnwYJKoZIhvcNAQcCoIIjkDCCI4wCAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCBaAkhEE6h6eRC8
# PNuVmX8gqB1OH9iNUMue/L7k9XXSxaCCDYEwggX/MIID56ADAgECAhMzAAAB32vw
# LpKnSrTQAAAAAAHfMA0GCSqGSIb3DQEBCwUAMH4xCzAJBgNVBAYTAlVTMRMwEQYD
# VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNy
# b3NvZnQgQ29ycG9yYXRpb24xKDAmBgNVBAMTH01pY3Jvc29mdCBDb2RlIFNpZ25p
# bmcgUENBIDIwMTEwHhcNMjAxMjE1MjEzMTQ1WhcNMjExMjAyMjEzMTQ1WjB0MQsw
# CQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9u
# ZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMR4wHAYDVQQDExVNaWNy
# b3NvZnQgQ29ycG9yYXRpb24wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB
# AQC2uxlZEACjqfHkuFyoCwf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