Skip to content

Commit 368e363

Browse files
authored
Merge pull request #26167 from dannysongg/allow-params-toggle
Fix bug in `Publish-AzWebApp` to allow params to be toggled off
2 parents e07f94b + 89a4dae commit 368e363

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

src/Websites/Websites/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Fix bug where parameters could not be set to false for `Publish-AzWebApp`
2122

2223
## Version 3.2.1
2324
* Introduced secrets detection feature to safeguard sensitive data.

src/Websites/Websites/Cmdlets/WebApps/PublishAzureWebApp.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,33 +119,34 @@ public override void ExecuteCmdlet()
119119

120120
paramValues.Add("path", TargetPath);
121121

122+
// Purposely using IsParameterBound to check if the parameter is passed or not. In this case we want to return true if $false is passed.
123+
// We only want to set the parameter if a value is passed.
122124
// default async to true if not provided to match old behavior
123-
if (Async.IsPresent)
125+
if (this.IsParameterBound(c => c.Async))
124126
{
125127
paramValues.Add("async", Async.ToString());
126128
}
127-
128129
else
129130
{
130131
paramValues.Add("async", "true");
131132
}
132133

133-
if (Restart.IsPresent)
134+
if (this.IsParameterBound(c => c.Restart))
134135
{
135136
paramValues.Add("restart", Restart.ToString());
136137
}
137138

138-
if (Clean.IsPresent)
139+
if (this.IsParameterBound(c => c.Clean))
139140
{
140141
paramValues.Add("clean", Clean.ToString());
141142
}
142143

143-
if (IgnoreStack.IsPresent)
144+
if (this.IsParameterBound(c => c.IgnoreStack))
144145
{
145146
paramValues.Add("ignorestack", IgnoreStack.ToString());
146147
}
147148

148-
if (Reset.IsPresent)
149+
if (this.IsParameterBound(c => c.Reset))
149150
{
150151
paramValues.Add("reset", Reset.ToString());
151152
}

tools/SecurityTools/CredScanSuppressions.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1340,6 +1340,10 @@
13401340
{
13411341
"file": "src\\Batch\\Batch.Test\\SessionRecords\\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.BatchAccountTests\\TestBatchAccountEndToEnd.json",
13421342
"_justification": "Legitimate session record. Test resources, keys and tokens are deleted."
1343+
},
1344+
{
1345+
"file": "tools\\TestFx\\Live\\LiveTestUtility.psm1",
1346+
"_justification": "Legitimate test session record, keys are deleted."
13431347
}
13441348
]
13451349
}

0 commit comments

Comments
 (0)