diff --git a/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/AvailabilitySetTests.ps1 b/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/AvailabilitySetTests.ps1
index 2df972e56a33..89a4fbfe6149 100644
--- a/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/AvailabilitySetTests.ps1
+++ b/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/AvailabilitySetTests.ps1
@@ -43,7 +43,9 @@ function Test-AvailabilitySet
Assert-AreEqual $aset.PlatformUpdateDomainCount $nonDefaultUD;
Assert-AreEqual $aset.PlatformFaultDomainCount $nonDefaultFD;
- Remove-AzureAvailabilitySet -ResourceGroupName $rgname -Name $asetName;
+ Assert-ThrowsContains { Remove-AzureAvailabilitySet -ResourceGroupName $rgname -Name $asetName; } "This cmdlet will remove the specified availability set. Do you want to continue?"
+
+ Remove-AzureAvailabilitySet -ResourceGroupName $rgname -Name $asetName -Force;
$asets = Get-AzureAvailabilitySet -ResourceGroupName $rgname;
Assert-AreEqual $asets $null;
diff --git a/src/ResourceManager/Compute/Commands.Compute/AvailabilitySets/RemoveAzureAvailabilitySetCommand.cs b/src/ResourceManager/Compute/Commands.Compute/AvailabilitySets/RemoveAzureAvailabilitySetCommand.cs
index b61ab1473155..1c59dd8b37fb 100644
--- a/src/ResourceManager/Compute/Commands.Compute/AvailabilitySets/RemoveAzureAvailabilitySetCommand.cs
+++ b/src/ResourceManager/Compute/Commands.Compute/AvailabilitySets/RemoveAzureAvailabilitySetCommand.cs
@@ -37,13 +37,24 @@ public class RemoveAzureAvailabilitySetCommand : AvailabilitySetBaseCmdlet
[ValidateNotNullOrEmpty]
public string Name { get; set; }
+ [Parameter(
+ Position = 2,
+ HelpMessage = "To force the removal.")]
+ [ValidateNotNullOrEmpty]
+ public SwitchParameter Force { get; set; }
+
public override void ExecuteCmdlet()
{
base.ExecuteCmdlet();
- var op = this.AvailabilitySetClient.Delete(this.ResourceGroupName, this.Name);
+ if (this.Force.IsPresent
+ || this.ShouldContinue(Properties.Resources.AvailabilitySetRemovalConfirmation,
+ Properties.Resources.AvailabilitySetRemovalCaption))
+ {
+ var op = this.AvailabilitySetClient.Delete(this.ResourceGroupName, this.Name);
- WriteObject(op);
+ WriteObject(op);
+ }
}
}
}
diff --git a/src/ResourceManager/Compute/Commands.Compute/Properties/Resources.Designer.cs b/src/ResourceManager/Compute/Commands.Compute/Properties/Resources.Designer.cs
index c7605bac79fa..230e4a350c03 100644
--- a/src/ResourceManager/Compute/Commands.Compute/Properties/Resources.Designer.cs
+++ b/src/ResourceManager/Compute/Commands.Compute/Properties/Resources.Designer.cs
@@ -60,6 +60,24 @@ internal Resources() {
}
}
+ ///
+ /// Looks up a localized string similar to Availability set removal operation.
+ ///
+ public static string AvailabilitySetRemovalCaption {
+ get {
+ return ResourceManager.GetString("AvailabilitySetRemovalCaption", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to This cmdlet will remove the specified availability set. Do you want to continue?.
+ ///
+ public static string AvailabilitySetRemovalConfirmation {
+ get {
+ return ResourceManager.GetString("AvailabilitySetRemovalConfirmation", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Cannot specify both Windows and Linux configurations..
///
diff --git a/src/ResourceManager/Compute/Commands.Compute/Properties/Resources.resx b/src/ResourceManager/Compute/Commands.Compute/Properties/Resources.resx
index c14a2af5faf2..ed628b2289c2 100644
--- a/src/ResourceManager/Compute/Commands.Compute/Properties/Resources.resx
+++ b/src/ResourceManager/Compute/Commands.Compute/Properties/Resources.resx
@@ -117,6 +117,12 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ Availability set removal operation
+
+
+ This cmdlet will remove the specified availability set. Do you want to continue?
+
Cannot specify both Windows and Linux configurations.
diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/Resources/resume_VHD.csv b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/Resources/resume_VHD.csv
index 3df33dd54eca..1bfb205b159d 100644
--- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/Resources/resume_VHD.csv
+++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/Resources/resume_VHD.csv
@@ -1,2 +1,2 @@
-vhdName,vhdBlobName,NoOfTimes,md5hash
+vhdName, vhdBlobName, NoOfTimes,md5hash
fixed_50.vhd,vhdstore/$guid$.vhd,1,lX67MyV6qURNTCWHDyg8Uw==
\ No newline at end of file