Azure PowerShell代码,用于在管道中的数据集之间循环
在Azure数据工厂中,我得到了以下代码来循环数据集Azure PowerShell代码,用于在管道中的数据集之间循环,powershell,azure,azure-powershell,azure-data-factory,Powershell,Azure,Azure Powershell,Azure Data Factory,在Azure数据工厂中,我得到了以下代码来循环数据集 Get-AzureRmDataFactoryDataset -ResourceGroupName "ADF" -DataFactoryName "WikiADF" 但是,我需要在属于特定管道的数据集之间循环。 无法获取它。数据集可以从同一工厂内的多个管道引用,因此要查找特定管道引用的数据集,您需要分析该管道本身。每个管道都有一个活动列表,每个活动列表都有一个输入和输出列表,每个输入和输出都是数据集引用。参考上面的Joseph注释,下面是代
Get-AzureRmDataFactoryDataset -ResourceGroupName "ADF" -DataFactoryName "WikiADF"
但是,我需要在属于特定管道的数据集之间循环。
无法获取它。数据集可以从同一工厂内的多个管道引用,因此要查找特定管道引用的数据集,您需要分析该管道本身。每个管道都有一个活动列表,每个活动列表都有一个输入和输出列表,每个输入和输出都是数据集引用。参考上面的Joseph注释,下面是代码
#Put your Data Factory name and Resource group here and pipeline
$RG = "asdf"
$DFname = "asdfasdf"
$Pipeline = "CopyPipeline-sdfas"
#Once per session - comment out to save time
#Login-AzureRmAccount
# Once, select a default subscription for your current session
#Get-AzureRmSubscription
#Set-AzureRmContext -SubscriptionId "asdfasdfasdfasdfasd"
# One time per computer - comment out to save time
# Register-AzureRmResourceProvider -ProviderNamespace Microsoft.DataFactory
# Debug option: List all DF in a resource group for debugging if needed
#Get-AzureRmDataFactory -ResourceGroupName $RG
# Find the Data Factory
$df= Get-AzureRmDataFactory -ResourceGroupName $RG -Name $DFname
if ($df -eq $null) { Write-Host "Data Factory " $DFname " cannot be found. Check spelling and resource group name. Error: " $_ -BackgroundColor:Red }
$activities = (Get-AzureRmDataFactoryPipeline -ResourceGroupName $RG -Name $Pipeline -DataFactoryName $DFname).Properties.Activities
$DataSets = [System.Collections.ArrayList]@()
ForEach($activity in $activities)
{
ForEach($tempDS in $activity.Inputs) {
Write-Host "temp ds name: " + $tempDS.Name
$DataSets.Add($tempDS)
}
ForEach($tempDS in $activity.Outputs) {
Write-Host "temp ds name output: " + $tempDS.Name
$DataSets.Add($tempDS)
}
#ForEach($tempDS in $activity.Outputs) { $AllDataSetNames.Add($tempDS.Name) }
#Write-Host "Input Activity: " + $activity.Inputs.ForEach('Name')
#Write-Host "Output Activity: " + $activity.Outputs.ForEach('Name')
}
Write-Host "all datasets:"
$DataSets.ForEach('Name')
我知道管道中的数据集,但我一直在寻找一种自动化解决方案(Powershell)来循环特定于管道的数据集名称。PS:我不想在代码中硬编码数据集名称。我们如何为Get-AzureRmDataFactoryV2Pipeline这样做