none
Exception at deleting dataset with PowerShell-script

    Question

  • Hello,

    I have a Problem with some PowerShell-script. I want to delete all pipelines and datasets with at once. I've made an script which gets all pipelines and datasets and deletes some of it.

    But I'll get every time the same error:

    Remove-AzureRmDataFactoryDataset : Eine Aufgabe wurde abgebrochen.
    At Delete_Template_Objects.ps1:29 char:9
    +         Remove-AzureRmDataFactoryDataset -DataFactoryName $DataFactor ...
    +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : CloseError: (:) [Remove-AzureRmDataFactoryDataset], TaskCanceledException
        + FullyQualifiedErrorId : Microsoft.Azure.Commands.DataFactories.RemoveAzureDataFactoryDatasetCommand

    I'll get the same execption also for the "Remove-AzureRmDataFactoryPipeline" command.

    Strange is, that the objects are removed though this error.

    My PowerShell-script:

    $templateObjects = Get-AzureRmDataFactoryPipeline -DataFactoryName $DataFactoryName -ResourceGroupName $resourceGroupName
    
    foreach ($templateObject in $templateObjects)
    {
        if($templateObject.PipelineName.StartsWith([PipelineName))
        {
            Remove-AzureRmDataFactoryPipeline -DataFactoryName $DataFactoryName -ResourceGroupName $resourceGroupName -Name $templateObject.PipelineName -Force
        }
    }
    
    $templateObjects = Get-AzureRMDataFactoryDataset -DataFactoryName $DataFactoryName -ResourceGroupName $resourceGroupName
    
    foreach ($templateObject in $templateObjects)
    {
        if($templateObject.DatasetName.StartsWith([DatasetName]))
        {
            Remove-AzureRmDataFactoryDataset -DataFactoryName $DataFactoryName -ResourceGroupName $resourceGroupName -Name $templateObject.DatasetName -Force
        }
    }


    Friday, November 24, 2017 6:53 AM