Skip to content

Commit

Permalink
ADServicePrincipalName: Call test at the top of set in case of explic…
Browse files Browse the repository at this point in the history
…it call to set function (#707)
  • Loading branch information
dan-hughes authored Apr 8, 2024
1 parent a74448e commit bdde66f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ For older change log history see the [historic changelog](HISTORIC_CHANGELOG.md)

## [Unreleased]

### Changed

- ADServicePrincipalName
- Add check to Set function to cover if `Invoke-DscResource -Method Set` is run and no changes are required.
([issue #520](https://github.com/dsccommunity/ActiveDirectoryDsc/issues/520))

## [6.4.0] - 2024-02-14

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,13 @@ function Set-TargetResource
$Account
)

# Test if the resource needs changing if called with Invoke-DscResource -Method Set
$inDesiredConfiguration = Test-TargetResource @PSBoundParameters
if ($inDesiredConfiguration)
{
return
}

# Get all Active Directory object having the target SPN configured.
$spnAccounts = Get-ADObject -Filter { ServicePrincipalName -eq $ServicePrincipalName } -Properties 'SamAccountName', 'DistinguishedName'

Expand Down

0 comments on commit bdde66f

Please sign in to comment.