Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADManagedServiceAccount: add ServicePrincipalNames setting #719

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rismoney
Copy link
Contributor

@rismoney rismoney commented Sep 3, 2024

  • This is a string array and specifies Service Principal Names for an AD Managed Service Account

Pull Request (PR) description

This Pull Request (PR) fixes the following issues

Task list

  • Added an entry to the change log under the Unreleased section of the file CHANGELOG.md.
    Entry should say what was changed and how that affects users (if applicable), and
    reference the issue being resolved (if applicable).
  • Resource documentation added/updated in README.md.
  • Resource parameter descriptions added/updated in README.md, schema.mof and comment-based
    help.
  • Comment-based help added/updated.
  • Localization strings added/updated in all localization files as appropriate.
  • Examples appropriately added/updated.
  • Unit tests added/updated. See DSC Community Testing Guidelines.
  • Integration tests added/updated (where possible). See DSC Community Testing Guidelines.
  • New/changed code adheres to DSC Community Style Guidelines.

This change is Reviewable

@rismoney rismoney force-pushed the spn branch 5 times, most recently from a590bb9 to 33ee483 Compare September 3, 2024 14:41
* This is a string array and specifies Service Principal Names for
an AD Managed Service Account
@rismoney
Copy link
Contributor Author

rismoney commented Sep 3, 2024

@johlju I am not sure I am doing mocks properly here.

Should call the correct mocks when ServicePrincipalNames has changed 55ms
2024-09-03T14:58:46.6342266Z           Exception: System.InvalidOperationException: Error setting Group Account 'TestGMSA'. (MSA0014) ---> System.Management.Automation.ParameterBindingException: Cannot convert 'System.String[]' to the type 'System.Collections.Hashtable' required by parameter 'ServicePrincipalNames'. Specified method is not supported. ---> System.NotSupportedException: Specified method is not supported.

I have been playing around with the datatypes a bit, and not sure how to properly handle this.
I believe the AD attribute specified by the cmdlets is in this notation 'a','b','c' which I believe is treated as an System.String[] which I believe to be an array of strings/System array. In the tests I was unsure if it should be $null, or @(). Also not totally what is up here. I haven't messed with pester in a long time so not sure if I have issue with code, or tests.

@rismoney
Copy link
Contributor Author

rismoney commented Sep 3, 2024

ugh I see now- set-adservice account uses serviceprincipals account as a hashtable. ok. love the MS consistency.

ref - https://learn.microsoft.com/en-us/powershell/module/activedirectory/set-adserviceaccount?view=windowsserver2022-ps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant