0
votes

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://docs.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'
1
Can you show part of pipeline related to Logic Apps?Krzysztof Madej
Hi, how about the issue? Does the answer below resolve your question, If yes, you could Accept it as an Answer , so it could help other community members who get the same issues and we could archive this thread, thanks.LoLance
Hi Lance, Sorry. I have not been able to confirm this yet as I have some other blockers in my release pipeline.A MIERS
That's ok, feel free to let me know when you get one chance to test my answer :)LoLance
How about the issue? Does the answer below resolved your question, If yes, you could Accept it as an Answer , so it could help other community members who get the same issues and we could archive this thread, thanks.Leo Liu-MSFT

1 Answers

0
votes

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.