Update ADF Webactivity url as per environment from CICD deployment

sai pavan 40 Reputation points
2023-09-26T13:12:20.9166667+00:00

Hi Team,

I'm working on ADF Web activity URL update as per env's from CICD Pipeline, can any one please help me out.

Thanks in Advance.

adf

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
0 comments No comments
{count} votes

Answer accepted by question author
  1. Bhargava-MSFT 31,361 Reputation points Microsoft Employee Moderator
    2023-09-28T01:25:33.37+00:00

    Hello sai pavan,

    If your requirement is to replace the dev URL with PROD on the release pipeline, you can simply use the override template parameters to replace the URL.

    User's image

    To parameterize the URL, Use the below block of code in the custom template-parameters-definition.json

    {
    "Microsoft.DataFactory/factories/pipelines": {
    "properties": {
    "activities": [{
    "typeProperties": {
    "url": "-"
    }
    }]
    }
    }
    }

    https://bhargavablog.com/2022/09/07/synapse-parametrize-url-at-activity-level/

    How to use custom parameters:
    https://learn.microsoft.com/en-us/azure/data-factory/continuous-integration-delivery-resource-manager-custom-parameters

    I hope this helps. Please let me know if you have any further questions.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Amira Bedhiafi 41,121 Reputation points Volunteer Moderator
    2023-09-26T13:55:44.5533333+00:00

    Go to the Linked Service connected with your Web Activity in your ADF instance.

    Try to make the URL a parameter like @linkedService().url.

    Then, export the ARM template of your ADF. Just try to add an entry for the URL parameter in the ARM template parameters file (arm_template_parameters.json). You'll have different values for each environment.

    If you are using Azure DevOps, You can set up up a pipeline variable for each environment like WebActivityURL_Dev, WebActivityURL_Staging, and WebActivityURL_Production.

    In the pipeline task that deploys the ADF ARM template, pass the relevant variable to the ARM template parameters where you can use conditions or stages in the pipeline to detect which environment you're deploying to and pass the correct URL.

       - stage: DeployToDev
         jobs:
         - deployment: Deploy
           environment: 'Dev'
           strategy:
             runOnce:
               deploy:
                 steps:
                 - template: azure-pipelines-deploy-template.yml
                   parameters:
                     webActivityURL: $(WebActivityURL_Dev)
       
       - stage: DeployToStaging
         jobs:
         ...
    

    In azure-pipelines-deploy-template.yml, you'd use the passed parameter to override the default in the ARM template parameters:

       parameters:
         webActivityURL: ''
       steps:
       - task: AzureResourceManagerTemplateDeployment@3
         inputs:
           ...
           overrideParameters: '-url $(webActivityURL)'
    

    Please test and tell us if it worked !


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.