From 2108d3454c862e81af00315015b45ec69de5a3f5 Mon Sep 17 00:00:00 2001 From: Yvan Duhamel Date: Tue, 21 Jul 2020 17:16:50 +0200 Subject: [PATCH 1/2] Test if property ClaimProviderName is omitted/null/empty --- CHANGELOG.md | 3 +++ .../MSFT_SPTrustedIdentityTokenIssuer.psm1 | 13 ++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 065878a6a..d249d0ae0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +- SPTrustedIdentityTokenIssuer + - Run Get-SPClaimProvider only if property ClaimProviderName is omitted/null/empty. + ### Fixed - SharePointDsc diff --git a/SharePointDsc/DSCResources/MSFT_SPTrustedIdentityTokenIssuer/MSFT_SPTrustedIdentityTokenIssuer.psm1 b/SharePointDsc/DSCResources/MSFT_SPTrustedIdentityTokenIssuer/MSFT_SPTrustedIdentityTokenIssuer.psm1 index 5e51bc14b..248c60bf9 100644 --- a/SharePointDsc/DSCResources/MSFT_SPTrustedIdentityTokenIssuer/MSFT_SPTrustedIdentityTokenIssuer.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPTrustedIdentityTokenIssuer/MSFT_SPTrustedIdentityTokenIssuer.psm1 @@ -294,13 +294,16 @@ function Set-TargetResource throw "SharePoint failed to create the SPTrustedIdentityTokenIssuer." } - $claimProvider = (Get-SPClaimProvider | Where-Object -FilterScript { + if ($false -eq [String]::IsNullOrWhiteSpace($params.ClaimProviderName)) + { + $claimProvider = (Get-SPClaimProvider | Where-Object -FilterScript { $_.DisplayName -eq $params.ClaimProviderName }) - if ($null -eq $claimProvider) - { - $trust.ClaimProviderName = $params.ClaimProviderName - } + if ($null -eq $claimProvider) + { + $trust.ClaimProviderName = $params.ClaimProviderName + } + } if ($params.ProviderSignOutUri) { From 67cd97cc35de4bcb0bda6c37c024564693694403 Mon Sep 17 00:00:00 2001 From: Yvan Duhamel Date: Tue, 21 Jul 2020 17:21:18 +0200 Subject: [PATCH 2/2] Fix spaces --- .../MSFT_SPTrustedIdentityTokenIssuer.psm1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SharePointDsc/DSCResources/MSFT_SPTrustedIdentityTokenIssuer/MSFT_SPTrustedIdentityTokenIssuer.psm1 b/SharePointDsc/DSCResources/MSFT_SPTrustedIdentityTokenIssuer/MSFT_SPTrustedIdentityTokenIssuer.psm1 index 248c60bf9..8d652b122 100644 --- a/SharePointDsc/DSCResources/MSFT_SPTrustedIdentityTokenIssuer/MSFT_SPTrustedIdentityTokenIssuer.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPTrustedIdentityTokenIssuer/MSFT_SPTrustedIdentityTokenIssuer.psm1 @@ -297,13 +297,13 @@ function Set-TargetResource if ($false -eq [String]::IsNullOrWhiteSpace($params.ClaimProviderName)) { $claimProvider = (Get-SPClaimProvider | Where-Object -FilterScript { - $_.DisplayName -eq $params.ClaimProviderName - }) + $_.DisplayName -eq $params.ClaimProviderName + }) if ($null -eq $claimProvider) { $trust.ClaimProviderName = $params.ClaimProviderName } - } + } if ($params.ProviderSignOutUri) {