Skip to content

Implement WhatIf PS adapter #840

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

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

Gijsreyn
Copy link
Contributor

PR Summary

This PR addresses #446 by adding WhatIf capability in the PowerShell adapter

PR Context

@Gijsreyn
Copy link
Contributor Author

Hi @SteveL-MSFT. I tried implementing the what-if on the PS adapter, but it seems the Azure artifacts are unauthorized. Could you mind taking a look, please?

@Gijsreyn Gijsreyn force-pushed the implement-whatif-powershelladapter branch 2 times, most recently from 2ec2255 to 3b715ab Compare May 30, 2025 03:58
Copy link
Member

@SteveL-MSFT SteveL-MSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a fundamental concern about this although I appreciate the effort. In PowerShell, scripts/cmdlets can use ShouldProcess as a way to get -whatif support. In this PR, you're modeling whatIf the same way we support it for native DSC resources. This ties into the conversation we had this morning about whether we should tell PS resource authors to have a class only for schema and implement functions instead where ShouldProcess would work. Although I suppose we COULD still support allowing a whatIf method on a class, but I would rather not create something no one will use.

"get": {
"$schema": "https://aka.ms/dsc/schemas/v3/bundled/resource/manifest.json",
"type": "Microsoft.DSC/PowerShell",
"version": "0.1.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we shipped, we should probably update this to 1.0.0 and increment as we make changes going forward, same for win-ps adapter

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood. I haven't tried using the ShouldProcess. I wasn't sure if that could be captured into a variable and returned to the DSC engine.

@Gijsreyn Gijsreyn force-pushed the implement-whatif-powershelladapter branch from c1824b9 to 95492ce Compare June 4, 2025 01:57
@michaeltlombardi
Copy link
Collaborator

Related issue for defining method signatures to support for DSC:

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

Successfully merging this pull request may close these issues.

3 participants