msgraph-sdk-powershell
msgraph-sdk-powershell copied to clipboard
Extend -WhatIf parameter
Add –WhatIf parameter so users can see what request will be sent to the service without actually sending it.
This effort includes, but may not be limited to just these tasks:
-
[ ] Adding –WhatIf parameter for all commands
-
[ ] Native –WhatIf
-
[ ] Service (AGS) –WhatIf
I just want to add that -WhatIf
support is a native feature of PowerShell. It is really helpful for admins learning the commands or doing a dry run before making changes. I have detailed guidance on how to implement it here https://powershellexplained.com/2020-03-15-Powershell-shouldprocess-whatif-confirm-shouldcontinue-everything
I noticed New-MgGroupMember
has the -whatif
flag and it works if you handle it directly, however it did not pick up the script $whatifpreference = $true
value which is bad. https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.2#whatifpreference
-WhatIf
parameter is already supported on all commands that make changes as stated in https://devblogs.microsoft.com/scripting/weekend-scripter-easily-add-whatif-support-to-your-powershell-functions/. Use Get-Command *-Mg* | where { $_.parameters.keys -Contains "WhatIf" }
to see commands that currently supports -WhatIf
.
This feature request should:
- [ ] Extend the current
-WhatIf
implementation by logging meaning messages about the operation being performed. This is being tracked in https://github.com/Azure/autorest.powershell/issues/213.
looking at using a directive to address for V2.
Closed by #1651