Azure

Azure DevOps Construct Set off: Integrating with Information Manufacturing unit/Synapse Pipeline

Downside Assertion 

The weblog Set off Azure DevOps Construct Pipeline by way of Azure Information Manufacturing unit / Synapse Pipeline describes set off a DevOps construct pipeline leveraging PAT authentication. As PATs are merely bearer tokens, which means token strings that characterize a person’s username and password, they’re extremely dangerous to make use of as they’ll simply fall into the fallacious individual’s fingers.

Is it doable to set off an Azure DevOps Construct Pipeline by way of Azure Information Manufacturing unit (ADF) / Synapse leveraging Managed Identification authentication for higher safety objective.

Conditions 

  1. Azure Information Manufacturing unit / Synapse

Resolution 

Azure DevOps helps Service Principal / Managed Identification authentications as said in MSFT Doc Use service principals & managed identities

We might be leveraging Azure DevOps REST API : Runs – Run Pipeline to Set off the Construct pipeline run.

Github Code

Register to your group ( https://dev.azure.com/{yourorganization} ) and choose a undertaking. Select Venture settings, after which select Permissions. Then choose Construct Directors > Members > Add. Enter the Managed id you need to add to the permission, after which choose Save.

Project settings

Create 3 Pipeline parameters.

Parameters

For which beneath are the values required

a) Group: This represents the identify of the Azure DevOps group.

Login to the Azure DevOps and click on on the Construct Pipeline.

Pattern URL format: https://dev.azure.com/group/undertaking/_apis/pipelines/pipelineId

DataSharx

The one highlighted in yellow represents the group.

b) Venture: The one highlighted in Inexperienced represents the Venture.

c) PipelineId: The one highlighted in Purple represents the PipelineId.

Set off Construct pipeline Config

Settings

  • URL: @concat(‘https://dev.azure.com/’,exchange(pipeline().parameters.group,’ ‘,’%20′),’/’,exchange(pipeline().parameters.undertaking,’ ‘,’%20′),’/_apis/pipelines/’,pipeline().parameters.pipelineId,’/runs?api-version=6.0-preview.1′)
  • Physique: {“assets”:{“repositories”:{“self”:{“refName”:”refs/heads/primary”}}}}
  • Useful resource: 499b84ac-1321-427f-aa17-267ca6975798

The Set off API name is asynchronous. Therefore, you have no idea whether or not the Construct Pipeline has truly succeeded. The profitable execution of the net exercise does solely imply that DevOps Pipeline was successful. To test the standing of the Pipeline one can leverage Net exercise to set off refresh standing by way of REST API.

Web

  • URL: @concat(‘https://dev.azure.com/’,exchange(pipeline().parameters.group,’ ‘,’%20′),’/’,exchange(pipeline().parameters.undertaking,’ ‘,’%20′),’/_apis/pipelines/’,pipeline().parameters.pipelineId,’/runs/’,string(exercise(‘TriggerBuilldPipeline’).output.id),’?api-version=7.0′)
  • Useful resource: 499b84ac-1321-427f-aa17-267ca6975798

Now we have so as to add a polling sample to periodically test on the standing of the refresh till it’s full. We begin with an till exercise. Within the settings of the till loop, we set the expression in order that the loop executes till the output of the above net exercise is the same as Accomplished.

Expression

Expression: @equals(exercise(‘GetBuildPipelineDetails’).output.state,’accomplished’)

The Closing exercise is the IF exercise that checks the Refresh standing and leverages a Fail exercise to fail the pipeline in case of DevOps Pipeline failure.

Activities

Expression: @not(equals(exercise(‘GetBuildPipelineDetails’).output.outcome,’succeeded’))

Fail

Fail Message: @concat(‘Pipeline ‘,exercise(‘GetBuildPipelineDetails’).output.pipeline.identify,’ ‘,exercise(‘GetBuildPipelineDetails’).output.outcome)

Output

Status

Links

Know extra about our firm at Skrots. Know extra about our companies at Skrots Providers, Additionally checkout all different blogs at Weblog at Skrots

Show More

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button