Search code examples
azure-devopsazure-devops-extensions

Integrating change request form/approval form into Azure DevOps before a release to Production


We use Azure DevOps for our code repo, and release pipelines to Production.

We also have a separate change request form (hosted in SharePoint) that the teams fill out and get approved (by the product owner, release manager) before running the actual pipeline. It contains information such as stakeholder approvals, time/date of change, deployment and rollback plan, etc.

Has anyone incorporated this type of change management-type functionality into Azure DevOps? I would like an integrated solution so that we can tie both processes together, preferable in the single tool, Azure DevOps? Also helps from a consolidated data and reporting view.

Thanks in advance!


Solution

  • There isn't anything out-of-box that can directly integrate with your custom SharePoint form, but Azure DevOps supports a number of Gates that can be called from Release and YAML pipelines. The out-of-box gates support invoking REST APIs, Function Apps and a few other options which can be used to query an external system and automatically proceed when the conditions are met.

    In your case, a function app that can query your SharePoint site for the approval status would be the best approach. For example, assuming your SharePoint list has the Build Name, Build Id, Environment and an Approval Status, your custom Function App could create a record in your SharePoint list for the current build if it doesn't exist or return the current approval status. You'd pass the build information to the Function app using querystring parameters or as part of the POST body if you'd prefer.

    Invoke Azure Function example

    The Invoke Function App gate should be configured to retry this endpoint every few minutes until either a success condition is present or the maximum timeout is reached.

    For example, if the build in your SharePoint list has been approved the function app would return:

    {
      "status": "approved"
    }
    

    You would verify the API response with the following:

    Approval Condition

    There are a number of different ways to integrate your function app with SharePoint. My team uses the SharePoint CSOM API, though other options do exist.

    If you don't want to use a function app, Azure DevOps does support writing your own custom gates. These custom gates are serverless, meaning the code is executed by the Azure DevOps server and must be on a public internet endpoint. There's a guide that works through creating custom gates and server tasks and cites the source-code for their own tasks (InvokeRestAPI, AzureFunction, etc). My guess is you would need to create a custom task that uses chained HTTP requests, similar to the ServiceNow gate or the Azure Policy gate. The ServiceNow integration typically creates the ticket in an earlier stage of the pipeline and then uses the Gate to wait for its approval. In my opinion, this may be a more cost effective approach as it doesn't require additional infrastructure, but there's a steep learning-curve and the complexity to develop and debug is much higher than developing a simple function app that you can test locally.