AzSynapseActivities.psm1
<#
.SYNOPSIS This command provide the list of pipelines , the list of activities coressponding to the pipelines , the count of the activities per pipeline and count of overall pipelines and overall activities in an Azure Synapse Workspace .DESCRIPTION The function helps to provide the list of pipelines , the list of activities coressponding to the pipelines , the count of the activities per pipeline and count of overall pipelines and overall activities in an Azure Synapse Workspace. One can provide the specific pipeline as the parameter if the details pertaining to that specific pipeline is needed. .PARAMETER WorkspaceName The name of the Synapse Workspace. .PARAMETER PipelineName The name of the Pipeline in the Synapse Workspace. .EXAMPLE Get-AzSynapseActivities -WorkspaceName "<<WorkspaceName>>" Get-AzSynapseActivities -WorkspaceName "<<WorkspaceName>>" -PipelineName "<<PipelineName>>" #> Function Get-AzSynapseActivities { Param ( [Parameter(Mandatory=$true)] [string] $WorkspaceName , [Parameter(Mandatory=$false)] [string] $PipelineName ) if (!$PipelineName) { $AllPipelineDataset = Get-AzSynapsePipeline -workspaceName $workspaceName -ErrorAction Stop $PipelineCount = $AllPipelineDataset.Count $ActivityCount =0 Write-Host "Pipelines Count :" $PipelineCount for ($i=0; $i -lt $PipelineCount ; $i++) { $OuterActivities= $PipelineDataset[$i].Activities.Name $DirectIfTrueActivity= $PipelineDataset[$i].Activities.IfTrueActivities.Name $DirectIfFalseActivity= $PipelineDataset[$i].Activities.IfFalseActivities.Name $InnerActivities=$PipelineDataset[$i].Activities.Activities.Name $InnertIfTrueActivity=$PipelineDataset[$i].Activities.Activities.IfTrueActivities.Name $InnertIfFalseActivity=$PipelineDataset[$i].Activities.Activities.IfFalseActivities.Name $DefaultSwitchActivities= $PipelineDataset[$i].Activities.DefaultActivities.Name $SwitchActivityCounter=$PipelineDataset[$i].Activities.cases $SwitchActivities=@() for ($j=0; $j -lt $SwitchActivityCounter.Count ; $j++) { [array]$SwitchActivities= [array]$SwitchActivities+ $SwitchActivityCounter[$j].Activities.name } $ActivitiesName= $SwitchActivities + $DefaultSwitchActivities + $InnertIfFalseActivity+$InnertIfTrueActivity+$InnerActivities+$DirectIfFalseActivity+$DirectIfTrueActivity+$OuterActivities $ActivitiesName=$ActivitiesName|Where-Object{$_} Write-Host "" # To add a line break between consecutive pipeline details Write-Host "PipelineName :" ($AllPipelineDataset[$i]).Name Write-Host "Pipeline Activities :" $ActivitiesName Write-Host "Pipeline Activities Count :" $ActivitiesName.Count $ActivityCount= $ActivityCount + $ActivitiesName.Count } Write-Host "`nTotal Number of Activities in $WorkspaceName : " $ActivityCount } else { $PipelineDataset= Get-AzSynapsePipeline -workspaceName $workspaceName -name $PipelineName -ErrorAction Stop $OuterActivities= $PipelineDataset.Activities.Name $DirectIfTrueActivity= $PipelineDataset.Activities.IfTrueActivities.Name $DirectIfFalseActivity= $PipelineDataset.Activities.IfFalseActivities.Name $InnerActivities=$PipelineDataset.Activities.Activities.Name $InnertIfTrueActivity=$PipelineDataset.Activities.Activities.IfTrueActivities.Name $InnertIfFalseActivity=$PipelineDataset.Activities.Activities.IfFalseActivities.Name $DefaultSwitchActivities= $PipelineDataset.Activities.DefaultActivities.Name $SwitchActivityCounter=$PipelineDataset.Activities.cases $SwitchActivities=@() for ($j=0; $j -lt $SwitchActivityCounter.Count ; $j++) { [array]$SwitchActivities= [array]$SwitchActivities+ $SwitchActivityCounter[$j].Activities.name } $ActivitiesName= $SwitchActivities + $DefaultSwitchActivities + $InnertIfFalseActivity+$InnertIfTrueActivity+$InnerActivities+$DirectIfFalseActivity+$DirectIfTrueActivity+$OuterActivities $ActivitiesName=$ActivitiesName|Where-Object{$_} Write-Host "PipelineName :" $PipelineName Write-Host "Pipeline Activities :" $ActivitiesName Write-Host "Pipeline Activities Count :" $ActivitiesName.Count } } Export-ModuleMember -Function Get-AzSynapseActivities |