0
votes

I need to do Continous Integration and Deployment for my Azure Data Factory (ADF).

For this in a Visual Studio solution I have two projects:

  • one for ADF json files(linked services, datasets etc.).
  • one for PowerShell script for deploying this ADF into a Azure subscription.

Steps followed

Took MSBUILD of ADF codes and used copy files task to copy into $(Build.ArtifactStagingDirectory).

Used Publish artifacts task to publish in VSTS.

Publish artifacts for PowerShell script as a separate build.

Release

In my release I have a Azure PowerShell script which will invoke these ADF files and deploy it in Azure subscription. I'm using "Build.ArtifactStagingDirectory" for referring my ADF files. But I'm getting the below error -

The term 'Build.ArtifactStagingDirectory' is not recognized as the name of a cmdlet, function, script file, or operable program

foreach($file in Get-ChildItem "$(Build.ArtifactStagingDirectory)" -filter "*LinkedService*")
{
    New-AzureRmDataFactoryLinkedService -ResourceGroupName "ADFAutomationResource" -DataFactoryName "ADFCICD190218" -Name $file.BaseName -File $file.FullName -Force | Format-List
}

Let me know how to proceed in this case..as there are no sufficient links explaining this.

2

2 Answers

0
votes

Try:

foreach($file in Get-ChildItem $Build.ArtifactStagingDirectory -filter "*LinkedService*")
{
    New-AzureRmDataFactoryLinkedService -ResourceGroupName "ADFAutomationResource" -DataFactoryName "ADFCICD190218" -Name $file.BaseName -File $file.FullName -Force | Format-List
}
0
votes

You're referencing a Build variable in a Release!

I assume you've added your artifacts to the release?

Release artifacts

If so; you should be able to refer to them like so:

$(System.DefaultWorkingDirectory)/<Artifact Name>