Sudip
Sudip

Reputation: 1

Azure Data factory pipeline and dependent triggers

I am trying to list all of my ADF pipelines and their dependent triggers. As per this article https://learn.microsoft.com/en-us/rest/api/datafactory/triggers/get there is a simple GET method which will list all the triggers with their associated pipelines. This is working fine when I use a web activity with GET method in ADF pipeline. I am trying to do the same using powershell. The pipeline name which is visible in ADF output is no longer visible when running via powershell.

Can someone please help me with the code below to identify what needs to be added to fetch the dependent pipeline name for a trigger when this GET method is executed. Any other approach will also be highly appreciated.

Connect-AzAccount -Identity
$azContext = Get-AzContext
$azProfile = [Microsoft.Azure.Commands.Common.Authentication.Abstractions.AzureRmProfileProvider]::Instance.Profile
$profileClient = New-Object -TypeName Microsoft.Azure.Commands.ResourceManager.Common.RMProfileClient -ArgumentList ($azProfile)
$token = $profileClient.AcquireAccessToken($azContext.Subscription.TenantId)
$authHeader = @{
    'Content-Type'='application/json'
    'Authorization'='Bearer ' + $token.AccessToken
}

$restUri = 'https://management.azure.com/subscriptions/1111111-1111-1111-11111-1111111/resourceGroups/resourceGroupName/providers/Microsoft.DataFactory/factories/DataFactoryName/triggers?api-version=2018-06-01'

$response = Invoke-RestMethod -Method GET -Header $authHeader -URI $restUri 
$response | ConvertTo-Json

Powershell Output - Using powershell 5.1 via Azure runbook

"value":  [
                  {
                      "id":  "/subscriptions/1234-1234-1234-1234/resourceGroups/ResourceGroupName/providers/Microsoft.DataFactory/factories/DataFactoryName/triggers/eventbasedtrigger",
                      "name":  "eventbasedtrigger",
                      "type":  "Microsoft.DataFactory/factories/triggers",
                      "properties":  "@{description=Tets Trigger; annotations=System.Object[]; runtimeState=Stopped; pipelines=System.Object[]; type=BlobEventsTrigger; typeProperties=}",
                      "etag":  "000000-0000-0d00-0000-0000000"
                  },

Cheers

Upvotes: 0

Views: 1694

Answers (1)

Pratik Somaiya
Pratik Somaiya

Reputation: 733

Powershell command Get-AzDataFactoryV2Trigger will provide you the list of triggers for an ADF pipeline / data factory

  1. To get information about all the triggers in ADF:

Get-AzDataFactoryV2Trigger -ResourceGroupName "<RG_NAME>" -DataFactoryName "<ADF_NAME>"

  1. Get information about a specific trigger

Get-AzDataFactoryV2Trigger -ResourceGroupName "<RG_NAME>" -DataFactoryName "<ADF_NAME>" -TriggerName "<TRIGGER_NAME>"

Upvotes: 0

Related Questions