Skip to content

Commit 43cbf18

Browse files
committed
Remove force parameter from Remove-AzureRmVmssDiagnosticsExtension
1 parent 52a55e6 commit 43cbf18

File tree

5 files changed

+7
-39
lines changed

5 files changed

+7
-39
lines changed

src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/DiagnosticsExtensionTests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ function Test-VmssDiagnosticsExtension
261261
Assert-AreNotEqual '' $storageAccountKey;
262262

263263
# Remove without specifying extension name, diagnostic extension is expected to be removed.
264-
$vmss = Remove-AzureRmVmssDiagnosticsExtension -VirtualMachineScaleSet $vmss -Force;
264+
$vmss = Remove-AzureRmVmssDiagnosticsExtension -VirtualMachineScaleSet $vmss;
265265
$vmssDiagExtensions = $vmss.VirtualMachineProfile.ExtensionProfile.Extensions | Where-Object {$_.Publisher -eq $diagExtPublisher -and $_.Type -eq $diagExtType};
266266

267267
Assert-Null $vmssDiagExtensions;
@@ -280,7 +280,7 @@ function Test-VmssDiagnosticsExtension
280280
$settings = $vmssDiagExtension.Settings;
281281
Assert-AreEqual $storagename $settings.storageAccount.Value;
282282

283-
Remove-AzureRmVmssDiagnosticsExtension -VirtualMachineScaleSet $vmss -Name $extname -Force;
283+
Remove-AzureRmVmssDiagnosticsExtension -VirtualMachineScaleSet $vmss -Name $extname;
284284
Update-AzureRmVmss -ResourceGroupName $rgname -Name $vmssName -VirtualMachineScaleSet $vmss;
285285

286286
$vmss = Get-AzureRmVmss -ResourceGroupName $rgname -VMScaleSetName $vmssName;

src/ResourceManager/Compute/Commands.Compute/Extension/Diagnostics/RemoveAzureRmVmssDiagnosticsExtension.cs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@ public class RemoveAzureRmVmssDiagnosticsExtension : Microsoft.Azure.Commands.Re
4343
HelpMessage = "The extension name.")]
4444
public string Name { get; set; }
4545

46-
[Parameter(Mandatory = false,
47-
HelpMessage = "To force the removal of the diagnostics extension from the VM scale set.")]
48-
public SwitchParameter Force { get; set; }
49-
5046
protected override void ProcessRecord()
5147
{
5248
if (ShouldProcess(this.VirtualMachineScaleSet.Name, Properties.Resources.RemoveVmssDiagnosticsExtensionAction))
@@ -68,15 +64,11 @@ protected override void ProcessRecord()
6864

6965
if (diagnosticsExtensions.Any())
7066
{
71-
if (Force.IsPresent ||
72-
ShouldContinue(Properties.Resources.DiagnosticsExtensionRemovalConfirmation, Properties.Resources.DiagnosticsExtensionRemovalCaption))
73-
{
74-
this.VirtualMachineScaleSet.VirtualMachineProfile.ExtensionProfile.Extensions = extensions.Except(diagnosticsExtensions).ToList();
67+
this.VirtualMachineScaleSet.VirtualMachineProfile.ExtensionProfile.Extensions = extensions.Except(diagnosticsExtensions).ToList();
7568

76-
if (this.VirtualMachineScaleSet.VirtualMachineProfile.ExtensionProfile.Extensions.Count == 0)
77-
{
78-
this.VirtualMachineScaleSet.VirtualMachineProfile.ExtensionProfile.Extensions = null;
79-
}
69+
if (this.VirtualMachineScaleSet.VirtualMachineProfile.ExtensionProfile.Extensions.Count == 0)
70+
{
71+
this.VirtualMachineScaleSet.VirtualMachineProfile.ExtensionProfile.Extensions = null;
8072
}
8173

8274
WriteObject(this.VirtualMachineScaleSet);

src/ResourceManager/Compute/Commands.Compute/Microsoft.Azure.Commands.Compute.dll-Help.xml

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/ResourceManager/Compute/Commands.Compute/Properties/Resources.Designer.cs

Lines changed: 0 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ResourceManager/Compute/Commands.Compute/Properties/Resources.resx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -551,10 +551,4 @@ The file needs to be a PowerShell script (.ps1 or .psm1) or a ZIP archive (.zip)
551551
<data name="RemoveVmssDiagnosticsExtensionAction" xml:space="preserve">
552552
<value>Remove diagnostics extension from the VM scale set</value>
553553
</data>
554-
<data name="DiagnosticsExtensionRemovalCaption" xml:space="preserve">
555-
<value>Diagnostics extension removal operation</value>
556-
</data>
557-
<data name="DiagnosticsExtensionRemovalConfirmation" xml:space="preserve">
558-
<value>This cmdlet will remove existing diagnostics extension. Do you want to continue?</value>
559-
</data>
560554
</root>

0 commit comments

Comments
 (0)