Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Synapse/Synapse.Test/ScenarioTests/FirewallTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function Test-SynapseFirewall
Assert-AreEqual $NewEndIpAddress $firewallUpdate.EndIpAddress

# Delete firewall
Assert-True {Remove-AzSynapseFirewallRule -ResourceGroupName $resourceGroupName -WorkspaceName $workspaceName -Name $firewallRuleName -PassThru} "Remove firewall rule failed"
Assert-True {Remove-AzSynapseFirewallRule -ResourceGroupName $resourceGroupName -WorkspaceName $workspaceName -Name $firewallRuleName -PassThru -Force} "Remove firewall rule failed"
}
finally
{
Expand Down
8 changes: 4 additions & 4 deletions src/Synapse/Synapse.Test/ScenarioTests/SparkPoolTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,16 @@ function Test-SynapseSparkPool
Assert-True {$found -eq 1} "SparkPool created earlier is not found when listing all in resource group: $resourceGroupName."

# Delete SparkPool
Assert-True {Remove-AzSynapseSparkPool -ResourceGroupName $resourceGroupName -WorkspaceName $workspaceName -Name $sparkPoolName -PassThru} "Remove SparkPool failed."
Assert-True {Remove-AzSynapseSparkPool -ResourceGroupName $resourceGroupName -WorkspaceName $workspaceName -Name $sparkPoolNameForAutoScale -PassThru} "Remove SparkPool failed."
Assert-True {Remove-AzSynapseSparkPool -ResourceGroupName $resourceGroupName -WorkspaceName $workspaceName -Name $sparkPoolName -PassThru -Force} "Remove SparkPool failed."
Assert-True {Remove-AzSynapseSparkPool -ResourceGroupName $resourceGroupName -WorkspaceName $workspaceName -Name $sparkPoolNameForAutoScale -PassThru -Force} "Remove SparkPool failed."

# Verify that it is gone by trying to get it again
Assert-Throws {Get-AzSynapseSparkPool -ResourceGroupName $resourceGroupName -WorkspaceName $workspaceName -Name $sparkPoolName}
}
finally
{
# cleanup the spark pool that was used in case it still exists. This is a best effort task, we ignore failures here.
Invoke-HandledCmdlet -Command {Remove-AzSynapseSparkPool -ResourceGroupName $resourceGroupName -WorkspaceName $workspaceName -Name $sparkPoolName -ErrorAction SilentlyContinue} -IgnoreFailures
Invoke-HandledCmdlet -Command {Remove-AzSynapseSparkPool -ResourceGroupName $resourceGroupName -WorkspaceName $workspaceName -Name $sparkPoolNameForAutoScale -ErrorAction SilentlyContinue} -IgnoreFailures
Invoke-HandledCmdlet -Command {Remove-AzSynapseSparkPool -ResourceGroupName $resourceGroupName -WorkspaceName $workspaceName -Name $sparkPoolName -ErrorAction SilentlyContinue -Force} -IgnoreFailures
Invoke-HandledCmdlet -Command {Remove-AzSynapseSparkPool -ResourceGroupName $resourceGroupName -WorkspaceName $workspaceName -Name $sparkPoolNameForAutoScale -ErrorAction SilentlyContinue -Force} -IgnoreFailures
}
}
4 changes: 2 additions & 2 deletions src/Synapse/Synapse.Test/ScenarioTests/SqlDatabaseTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function Test-SynapseSqlDatabase
Assert-True {$found -eq 1} "SqlDatabase created earlier is not found when listing all in resource group: $resourceGroupName."

# Delete SqlDatabase
Assert-True {Remove-AzSynapseSqlDatabase -ResourceGroupName $resourceGroupName -WorkspaceName $workspaceName -Name $SqlDatabaseName -PassThru} "Remove SqlDatabase failed."
Assert-True {Remove-AzSynapseSqlDatabase -ResourceGroupName $resourceGroupName -WorkspaceName $workspaceName -Name $SqlDatabaseName -PassThru -Force} "Remove SqlDatabase failed."

[Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities]::Wait(180000)

Expand All @@ -68,6 +68,6 @@ function Test-SynapseSqlDatabase
finally
{
# cleanup the SQL pool that was used in case it still exists. This is a best effort task, we ignore failures here.
Invoke-HandledCmdlet -Command {Remove-AzSynapseSqlDatabase -ResourceGroupName $resourceGroupName -WorkspaceName $workspaceName -Name $SqlDatabaseName -ErrorAction SilentlyContinue} -IgnoreFailures
Invoke-HandledCmdlet -Command {Remove-AzSynapseSqlDatabase -ResourceGroupName $resourceGroupName -WorkspaceName $workspaceName -Name $SqlDatabaseName -ErrorAction SilentlyContinue -Force} -IgnoreFailures
}
}
4 changes: 2 additions & 2 deletions src/Synapse/Synapse.Test/ScenarioTests/SqlPoolTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function Test-SynapseSqlPool
Assert-True {$found -eq 1} "SqlPool created earlier is not found when listing all in resource group: $resourceGroupName."

# Delete SqlPool
Assert-True {Remove-AzSynapseSqlPool -ResourceGroupName $resourceGroupName -WorkspaceName $workspaceName -Name $sqlPoolName -PassThru} "Remove SqlPool failed."
Assert-True {Remove-AzSynapseSqlPool -ResourceGroupName $resourceGroupName -WorkspaceName $workspaceName -Name $sqlPoolName -PassThru -Force} "Remove SqlPool failed."

# Verify that it is gone by trying to get it again
Assert-Throws {Get-AzSynapseSqlPool -ResourceGroupName $resourceGroupName -WorkspaceName $workspaceName -Name $sqlPoolName}
Expand Down Expand Up @@ -120,6 +120,6 @@ function Test-SynapseSqlPool
finally
{
# cleanup the SQL pool that was used in case it still exists. This is a best effort task, we ignore failures here.
Invoke-HandledCmdlet -Command {Remove-AzSynapseSqlPool -ResourceGroupName $resourceGroupName -WorkspaceName $workspaceName -Name $sqlPoolName -ErrorAction SilentlyContinue} -IgnoreFailures
Invoke-HandledCmdlet -Command {Remove-AzSynapseSqlPool -ResourceGroupName $resourceGroupName -WorkspaceName $workspaceName -Name $sqlPoolName -ErrorAction SilentlyContinue -Force} -IgnoreFailures
}
}
4 changes: 2 additions & 2 deletions src/Synapse/Synapse.Test/ScenarioTests/SqlPoolV3Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function Test-SynapseSqlPoolV3
Assert-True {$found -eq 1} "SqlPool created earlier is not found when listing all in resource group: $resourceGroupName."

# Delete SqlPool
Assert-True {Remove-AzSynapseSqlPool -ResourceGroupName $resourceGroupName -WorkspaceName $workspaceName -Name $sqlPoolName -Version 3 -PassThru} "Remove SqlPool failed."
Assert-True {Remove-AzSynapseSqlPool -ResourceGroupName $resourceGroupName -WorkspaceName $workspaceName -Name $sqlPoolName -Version 3 -PassThru -Force} "Remove SqlPool failed."

[Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities]::Wait(180000)

Expand All @@ -96,6 +96,6 @@ function Test-SynapseSqlPoolV3
finally
{
# cleanup the SQL pool that was used in case it still exists. This is a best effort task, we ignore failures here.
Invoke-HandledCmdlet -Command {Remove-AzSynapseSqlPool -ResourceGroupName $resourceGroupName -WorkspaceName $workspaceName -Name $sqlPoolName -Version 3 -ErrorAction SilentlyContinue} -IgnoreFailures
Invoke-HandledCmdlet -Command {Remove-AzSynapseSqlPool -ResourceGroupName $resourceGroupName -WorkspaceName $workspaceName -Name $sqlPoolName -Version 3 -ErrorAction SilentlyContinue -Force} -IgnoreFailures
}
}
4 changes: 2 additions & 2 deletions src/Synapse/Synapse.Test/ScenarioTests/WorkspaceTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,15 @@ function Test-SynapseWorkspace
Assert-True {$found -eq 1} "Workspace created earlier is not found when listing all in subscription."

# Delete workspace
Assert-True {Remove-AzSynapseWorkspace -ResourceGroupName $resourceGroupName -Name $workspaceName -PassThru} "Remove Workspace failed."
Assert-True {Remove-AzSynapseWorkspace -ResourceGroupName $resourceGroupName -Name $workspaceName -PassThru -Force} "Remove Workspace failed."

# Verify that it is gone by trying to get it again
Assert-Throws {Get-AzSynapseWorkspace -ResourceGroupName $resourceGroupName -Name $workspaceName}
}
finally
{
# cleanup the resource group that was used in case it still exists. This is a best effort task, we ignore failures here.
Invoke-HandledCmdlet -Command {Remove-AzSynapseWorkspace -ResourceGroupName $resourceGroupName -Name $workspaceName -ErrorAction SilentlyContinue} -IgnoreFailures
Invoke-HandledCmdlet -Command {Remove-AzSynapseWorkspace -ResourceGroupName $resourceGroupName -Name $workspaceName -ErrorAction SilentlyContinue -Force} -IgnoreFailures
Invoke-HandledCmdlet -Command {Remove-AzResourceGroup -Name $resourceGroupName -Force -ErrorAction SilentlyContinue} -IgnoreFailures
}
}
1 change: 1 addition & 0 deletions src/Synapse/Synapse/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- Additional information about change #1
-->
## Upcoming Release
* Add `-Force` to all Remove cmdlets

## Version 0.3.0
* Added support for operation of Synapse LinkedService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ public class RemoveAzureSynapseDataFlow : SynapseArtifactsCmdletBase
[Parameter(Mandatory = false, HelpMessage = HelpMessages.AsJob)]
public SwitchParameter AsJob { get; set; }

[Parameter(Mandatory = false, HelpMessage = HelpMessages.Force)]
public SwitchParameter Force { get; set; }

public override void ExecuteCmdlet()
{
if (this.IsParameterBound(c => c.WorkspaceObject))
Expand All @@ -60,14 +63,19 @@ public override void ExecuteCmdlet()
this.Name = this.InputObject.Name;
}

if (this.ShouldProcess(this.WorkspaceName, String.Format(Resources.RemovingSynapseDataFlow, this.Name, this.WorkspaceName)))
{
SynapseAnalyticsClient.DeleteDataFlow(this.Name);
if (PassThru)
ConfirmAction(
Force.IsPresent,
string.Format(Resources.RemoveSynapseDataFlow, Name),
string.Format(Resources.RemovingSynapseDataFlow, this.Name, this.WorkspaceName),
Name,
() =>
{
WriteObject(true);
}
}
SynapseAnalyticsClient.DeleteDataFlow(this.Name);
if (PassThru)
{
WriteObject(true);
}
});
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ public class RemoveAzureSynapseDataset : SynapseArtifactsCmdletBase
[Parameter(Mandatory = false, HelpMessage = HelpMessages.AsJob)]
public SwitchParameter AsJob { get; set; }

[Parameter(Mandatory = false, HelpMessage = HelpMessages.Force)]
public SwitchParameter Force { get; set; }

public override void ExecuteCmdlet()
{
if (this.IsParameterBound(c => c.WorkspaceObject))
Expand All @@ -62,14 +65,19 @@ public override void ExecuteCmdlet()
this.Name = this.InputObject.Name;
}

if (this.ShouldProcess(this.WorkspaceName, String.Format(Resources.RemovingSynapseDataset, this.Name, this.WorkspaceName)))
{
SynapseAnalyticsClient.DeleteDataset(this.Name);
if (PassThru)
ConfirmAction(
Force.IsPresent,
string.Format(Resources.RemoveSynapseDataset, Name),
string.Format(Resources.RemovingSynapseDataset, this.Name, this.WorkspaceName),
Name,
() =>
{
WriteObject(true);
}
}
SynapseAnalyticsClient.DeleteDataset(this.Name);
if (PassThru)
{
WriteObject(true);
}
});
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ public class RemoveAzureSynapseLinkedService : SynapseArtifactsCmdletBase
[Parameter(Mandatory = false, HelpMessage = HelpMessages.AsJob)]
public SwitchParameter AsJob { get; set; }

[Parameter(Mandatory = false, HelpMessage = HelpMessages.Force)]
public SwitchParameter Force { get; set; }

public override void ExecuteCmdlet()
{
if (this.IsParameterBound(c => c.WorkspaceObject))
Expand All @@ -60,14 +63,19 @@ public override void ExecuteCmdlet()
this.Name = this.InputObject.Name;
}

if (this.ShouldProcess(this.WorkspaceName, String.Format(Resources.RemovingSynapseLinkedService, this.Name, this.WorkspaceName)))
{
SynapseAnalyticsClient.DeleteLinkedService(this.Name);
if (PassThru)
ConfirmAction(
Force.IsPresent,
string.Format(Resources.RemoveSynapseLinkedService, Name),
string.Format(Resources.RemovingSynapseLinkedService, this.Name, this.WorkspaceName),
Name,
() =>
{
WriteObject(true);
}
}
SynapseAnalyticsClient.DeleteLinkedService(this.Name);
if (PassThru)
{
WriteObject(true);
}
});
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Microsoft.Azure.Commands.Synapse.Models;
using Microsoft.Azure.Commands.Synapse.Properties;
using Microsoft.WindowsAzure.Commands.Utilities.Common;
using System;
using System.Management.Automation;

namespace Microsoft.Azure.Commands.Synapse
Expand Down Expand Up @@ -47,6 +46,9 @@ public class RemoveAzureSynapseNotebook : SynapseArtifactsCmdletBase
[Parameter(Mandatory = false, HelpMessage = HelpMessages.AsJob)]
public SwitchParameter AsJob { get; set; }

[Parameter(Mandatory = false, HelpMessage = HelpMessages.Force)]
public SwitchParameter Force { get; set; }

public override void ExecuteCmdlet()
{
if (this.IsParameterBound(c => c.WorkspaceObject))
Expand All @@ -60,14 +62,19 @@ public override void ExecuteCmdlet()
this.Name = this.InputObject.Name;
}

if (this.ShouldProcess(this.WorkspaceName, String.Format(Resources.RemovingSynapseNotebook, this.Name, this.WorkspaceName)))
{
SynapseAnalyticsClient.DeleteNotebook(this.Name);
if (PassThru)
ConfirmAction(
Force.IsPresent,
string.Format(Resources.RemoveSynapseNotebook, Name),
string.Format(Resources.RemovingSynapseNotebook, this.Name, this.WorkspaceName),
Name,
() =>
{
WriteObject(true);
}
}
SynapseAnalyticsClient.DeleteNotebook(this.Name);
if (PassThru)
{
WriteObject(true);
}
});
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ public class RemoveAzureSynapsePipeline : SynapseArtifactsCmdletBase
[Parameter(Mandatory = false, HelpMessage = HelpMessages.AsJob)]
public SwitchParameter AsJob { get; set; }

[Parameter(Mandatory = false, HelpMessage = HelpMessages.Force)]
public SwitchParameter Force { get; set; }

public override void ExecuteCmdlet()
{
if (this.IsParameterBound(c => c.WorkspaceObject))
Expand All @@ -57,14 +60,19 @@ public override void ExecuteCmdlet()
this.Name = this.InputObject.Name;
}

if (this.ShouldProcess(this.WorkspaceName, String.Format(Resources.RemovingSynapsePipeline, this.Name, this.WorkspaceName)))
{
SynapseAnalyticsClient.DeletePipeline(this.Name);
if (PassThru)
ConfirmAction(
Force.IsPresent,
string.Format(Resources.RemoveSynapsePipeline, Name),
string.Format(Resources.RemovingSynapsePipeline, this.Name, this.WorkspaceName),
Name,
() =>
{
WriteObject(true);
}
}
SynapseAnalyticsClient.DeletePipeline(this.Name);
if (PassThru)
{
WriteObject(true);
}
});
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ public class RemoveAzureSynapseTrigger : SynapseArtifactsCmdletBase
[Parameter(Mandatory = false, HelpMessage = HelpMessages.AsJob)]
public SwitchParameter AsJob { get; set; }

[Parameter(Mandatory = false, HelpMessage = HelpMessages.Force)]
public SwitchParameter Force { get; set; }

public override void ExecuteCmdlet()
{
if (this.IsParameterBound(c => c.WorkspaceObject))
Expand All @@ -60,14 +63,19 @@ public override void ExecuteCmdlet()
this.Name = this.InputObject.Name;
}

if (this.ShouldProcess(this.WorkspaceName, String.Format(Resources.RemovingSynapseTrigger, this.Name, this.WorkspaceName)))
{
SynapseAnalyticsClient.DeleteTrigger(this.Name);
if (PassThru)
ConfirmAction(
Force.IsPresent,
string.Format(Resources.RemoveSynapseTrigger, Name),
string.Format(Resources.RemovingSynapseTrigger, this.Name, this.WorkspaceName),
Name,
() =>
{
WriteObject(true);
}
}
SynapseAnalyticsClient.DeleteTrigger(this.Name);
if (PassThru)
{
WriteObject(true);
}
});
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ public class RemoveAzureSynapseTriggerSubscription : SynapseArtifactsCmdletBase
[Parameter(Mandatory = false, HelpMessage = HelpMessages.AsJob)]
public SwitchParameter AsJob { get; set; }

[Parameter(Mandatory = false, HelpMessage = HelpMessages.Force)]
public SwitchParameter Force { get; set; }

public override void ExecuteCmdlet()
{
if (this.IsParameterBound(c => c.WorkspaceObject))
Expand All @@ -62,12 +65,21 @@ public override void ExecuteCmdlet()

if (this.ShouldProcess(this.WorkspaceName, String.Format(Resources.RemovingSynapseTriggerSubscription, this.Name)))
{
SynapseAnalyticsClient.StartUnsubscribeTriggerFromEvents(this.Name);
if (PassThru)
{
WriteObject(true);
}
}
Comment thread
idear1203 marked this conversation as resolved.
Outdated

ConfirmAction(
Force.IsPresent,
string.Format(Resources.RemoveSynapseTriggerSubscription, Name),
string.Format(Resources.RemovingSynapseTriggerSubscription, this.Name),
Name,
() =>
{
SynapseAnalyticsClient.StartUnsubscribeTriggerFromEvents(this.Name);
if (PassThru)
{
WriteObject(true);
}
});
}
}
}
Loading