Azure / Azure/arm-template-whatif
-WhatIfResultFormat comes up first but doesn't trigger -WhatIf
- Dominant language
- HTML
- Stars
- 101
- Forks
- 21
- Avg merge
- 3h 35m
- Merged PRs (30d)
- 1
Description
**Describe the bug**
When you type ```New-AzResourceGroupDeployment -W``` and use tab to complete, the first suggestion is the parameter WhatIfResultFormat.
I feel there are two problems:
- I think -WhatIf should be the first option shown, as WhatIfResultFormat is part of -Whatif
- If you fill in WhatIfResultFormat but do not define WhatIf, the What-If functionality will not be used and the resources will be deployed. I think that is counter intuitive.
**To Reproduce**
Steps to reproduce the behavior:
1. In PowerShell, type
```PowerShell
New-AzResourceGroupDeployment -W
```
2. Use tab to complete.
3. To test deployment, create complete New-AzResourceGroupDeployment parameter and end with ```-WhatIfResultFormat ResourceIdOnly```
**Expected behavior**
- I would expect the first parameter to autocomplete to be WhatIf, not WhatIfResultFormat
- I would expect for -WhatIfResultFormat one of the following:
- Is not available if -WhatIf hasn't been used,
- Triggers WhatIf instead of deploying the resources.
- Gives an error when used without -WhatIf
**Screenshots**

**Client** [e.g. PowerShell, CLI, API)
```
C:\> $PSVersionTable
Name Value
---- -----
PSVersion 7.1.2
PSEdition Core
GitCommitId 7.1.2
OS Microsoft Windows 10.0.18363
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
C:\> Get-InstalledModule az.resources
Version Name Repository Description
------- ---- ---------- -----------
3.3.0 Az.Resources PSGallery Microsoft Azur…
C:\> Get-InstalledModule az
Version Name Repository Description
------- ---- ---------- -----------
5.5.0 Az PSGallery Microsoft Azur…
```
**Additional context**
Add any other context about the problem here.
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the behavior by running New-AzResourceGroupDeployment -W in PowerShell and completing the parameter, then compare it with -WhatIfResultFormat ResourceIdOnly. Trace the parameter definitions and completion behavior for this command; done means -WhatIf is suggested first and using -WhatIfResultFormat without -WhatIf is unavailable, triggers What-If, or reports an error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100