0

Long title: Azure Logic App, deployed using DevOps, first step "When a HTTP request is received", how to get the URL as output variable for use in deployment of App Service calling this Logic App?

My azure application is composed of two parts:

  1. a Logic App
  2. an App Service (web) which are both deployed using DevOps.

The first step of the logic app is "When a HTTP request is received".

The web has a dependency on the generated url (e.g. https://prod-23.usgovarizona.logic.azure.us:443/workflows/.../triggers/request/paths/invoke?api-version=2016-10-01&sp=%2Ftriggers%2Frequest%2Frun&sv=1.0&sig=...) of the logic app.

How do I get the URL of the logic apps' first step as an output variable, so that I can supply that value in the deployment of the App Service, which calls the Logic App?

I looked at https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/template-outputs?tabs=azure-powershell but that didn't help me.

release.json

{
"source": 2,
"revision": 59,
"description": null,
"lastRelease": {
    "id": 853,
    "name": "Release-37",
    "artifacts": [],
    "_links": {},
    "description": "Triggered by SMS Scheduler 2020.206.01.",
    "releaseDefinition": {
        "id": 14,
        "projectReference": null,
        "_links": {}
    },
},
"variables": {
    "depr_AppTeam": {
        "value": "SDIS"
    },
    "depr_DeptAbbr": {
        "value": "ENT"
    },
    "depr_ResourceGroupName": {
        "value": "$AppTeam+ \"-\"+ $AppName +\"-\"+$Env + \"-rg\""
    }
},
"variableGroups": [
    43
],
"environments": [
    {
        "id": 24,
        "name": "DEV",
        "rank": 1,
        "variables": {},
        "variableGroups": [],
        "deployStep": {
            "id": 90
        },
        "deployPhases": [
            {
                "deploymentInput": {
                    "parallelExecution": {
                        "parallelExecutionType": 0
                    },
                    "agentSpecification": {
                        "identifier": "vs2017-win2016"
                    },
                    "skipArtifactsDownload": false,
                    "artifactsDownloadInput": {
                        "downloadInputs": []
                    },
                    "queueId": 64,
                    "demands": [],
                    "enableAccessToken": false,
                    "timeoutInMinutes": 0,
                    "jobCancelTimeoutInMinutes": 1,
                    "condition": "succeeded()",
                    "overrideInputs": {}
                },
                "rank": 1,
                "phaseType": 1,
                "name": "Agent job",
                "refName": null,
                "workflowTasks": [
                    {
                        "environment": {},
                        "taskId": "94a...",
                        "version": "2.*",
                        "name": "Azure Deployment:Create Or Update Resource Group action on $(AppTeam)-$(AppName)-$(Release.EnvironmentName)-rg",
                        "refName": "",
                        "enabled": true,
                        "alwaysRun": false,
                        "continueOnError": false,
                        "timeoutInMinutes": 0,
                        "definitionType": "task",
                        "overrideInputs": {},
                        "condition": "succeeded()",
                        "inputs": {
                            "ConnectedServiceName": "nov...",
                            "action": "Create Or Update Resource Group",
                            "resourceGroupName": "$(AppTeam)-$(AppName)-$(Release.EnvironmentName)-rg",
                            "location": "USGov Arizona",
                            "templateLocation": "Linked artifact",
                            "csmFileLink": "",
                            "csmParametersFileLink": "",
                            "csmFile": "$(System.DefaultWorkingDirectory)/_ent_sms_scheduler/Job1/template.json",
                            "csmParametersFile": "$(System.DefaultWorkingDirectory)/_ent_sms_scheduler/Job1/parameters.json",
                            "overrideParameters": "",
                            "deploymentMode": "Incremental",
                            "enableDeploymentPrerequisites": "None",
                            "deploymentGroupEndpoint": "",
                            "project": "",
                            "deploymentGroupName": "",
                            "copyAzureVMTags": "true",
                            "runAgentServiceAsUser": "false",
                            "userName": "",
                            "password": "",
                            "outputVariable": "",
                            "deploymentName": "",
                            "deploymentOutputs": "",
                            "addSpnToEnvironment": "false"
                        }
                    },
                ]
            }
        ],
    },
],
"triggers": [
    {
        "artifactAlias": "_ent_sms_scheduler",
        "triggerConditions": [],
        "triggerType": 1
    }
],
"releaseNameFormat": "Release-$(rev:r)",
"tags": [],
"properties": {
    "DefinitionCreationSource": {
        "$type": "System.String",
        "$value": "ReleaseNew"
    },
    "IntegrateJiraWorkItems": {
        "$type": "System.String",
        "$value": "false"
    },
    "IntegrateBoardsWorkItems": {
        "$type": "System.String",
        "$value": "False"
    }
},
"id": 14,
"name": "SMS SCHEDULER",
"path": "\\",
"projectReference": null,
"url": "https://vsrm.dev.azure.com/.../.../_apis/Release/definitions/14",
"_links": {
    "self": {
        "href": "https://vsrm.dev.azure.com/.../.../_apis/Release/definitions/14"
    },
    "web": {
        "href": "https://dev.azure.com/.../.../_release?definitionId=14"
    }
}

}

release task:

steps:
- task: AzureResourceGroupDeployment@2
  displayName: 'Azure Deployment:Create Or Update Resource Group action on $(AppTeam)-$(AppName)-$(Release.EnvironmentName)-rg'
  inputs:
    azureSubscription: 'ENT-eComm-Deployment-NonProd-Gov-Connection'
    resourceGroupName: '$(AppTeam)-$(AppName)-$(Release.EnvironmentName)-rg'
    location: 'USGov Arizona'
    csmFile: '$(System.DefaultWorkingDirectory)/_ent_sms_scheduler/Job1/template.json'
    csmParametersFile: '$(System.DefaultWorkingDirectory)/_ent_sms_scheduler/Job1/parameters.json'
LoLance
  • 25,666
  • 1
  • 39
  • 73
A MIERS
  • 132
  • 10
  • Can you show part of pipeline related to Logic Apps? – Krzysztof Madej Oct 01 '20 at 20:43
  • Hi, how about the issue? Does the answer below resolve your question, If yes, you could [Accept it as an Answer](https://meta.stackexchange.com/a/5235/515442) , so it could help other community members who get the same issues and we could archive this thread, thanks. – LoLance Oct 08 '20 at 09:44
  • Hi Lance, Sorry. I have not been able to confirm this yet as I have some other blockers in my release pipeline. – A MIERS Oct 09 '20 at 13:08
  • That's ok, feel free to let me know when you get one chance to test my answer :) – LoLance Oct 12 '20 at 02:13

1 Answers1

0

It seems that you deploy Azure Logic App first, and then App Service.

You can add an Azure Powershell task after you deploy the Azure Logic app. Call Get-AzLogicAppTriggerCallbackUrl command to get specific Logic App trigger callback URL. Example:

Get-AzLogicAppTriggerCallbackUrl -ResourceGroupName "ResourceGroup11" -Name "LogicApp1" -TriggerName "manual"
Value                                                                                                                                                                                                               
-----                                                                                                                                                                                                               
https://prod-03.westus.logic.azure.com:443/workflows/c4ed9335bc864140a11f4508d19acea3/triggers/manual/run?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=

And then you can define variables whose value is the response URL. Follow use variables as inputs and detailed sample to output this variable to following tasks.

LoLance
  • 25,666
  • 1
  • 39
  • 73
  • Thanks Lance, I'll give that a try once my permissions are fixed. Right now I'm unable to edit/create releases. I'm also going to try the methods from these two posts: https://learn.microsoft.com/en-us/rest/api/logic/WorkflowTriggers/ListCallbackUrl and https://mindbyte.nl/2019/02/13/Retrieve-the-callback-url-of-a-logic-app-inside-your-ARM-template.html – A MIERS Oct 05 '20 at 19:41
  • The first link is the Rest api way, it should also work for you when calling it via Azure Devops PS task. Both the `Get-AzLogicAppTriggerCallbackUrl`(Power command) and `Workflow Triggers` are officially recommended way :) – LoLance Oct 06 '20 at 06:21