【问题标题】:Azure Logic App, deployed using DevOps, first step "When a HTTP request is received", how to get the URL as output variableAzure Logic App,使用 DevOps 部署,第一步“收到 HTTP 请求时”,如何获取 URL 作为输出变量
【发布时间】:2021-01-17 14:50:04
【问题描述】:

长标题:Azure Logic App,使用 DevOps 部署,第一步“收到 HTTP 请求时”,如何获取 URL 作为输出变量,用于部署调用此逻辑应用的 App Service?

我的天蓝色应用由两部分组成:

  1. 一个逻辑应用程序
  2. 应用服务 (web) 它们都是使用 DevOps 部署的。

逻辑应用的第一步是“收到 HTTP 请求时”。

web 对生成的 url 有依赖 (例如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=...)的逻辑应用。

如何获取逻辑应用第一步的 URL 作为输出变量, 这样我就可以在应用服务的部署中提供该价值, 哪个调用逻辑应用?

我查看了https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/template-outputs?tabs=azure-powershell,但这对我没有帮助。

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"
    }
}

}

发布任务:

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'

【问题讨论】:

  • 你能展示与逻辑应用相关的部分管道吗?
  • 您好,请问这个问题呢?下面的答案是否解决了您的问题,如果是,您可以Accept it as an Answer,这样它可以帮助遇到相同问题的其他社区成员,我们可以存档这个帖子,谢谢。
  • 嗨兰斯,对不起。我还不能确认这一点,因为我的发布管道中还有其他一些障碍。
  • 没关系,如果你有机会测试我的答案,请随时告诉我 :)
  • 这个问题怎么样?下面的答案是否解决了您的问题,如果是,您可以 Accept it as an Answer ,这样它可以帮助遇到相同问题的其他社区成员,我们可以存档这个帖子,谢谢。

标签: azure azure-devops azure-logic-apps


【解决方案1】:

看来你是先部署 Azure Logic App,再部署 App Service。

您可以在部署 Azure 逻辑应用后添加 Azure Powershell 任务。调用Get-AzLogicAppTriggerCallbackUrl 命令获取特定的逻辑应用触发回调 URL。示例:

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=

然后您可以定义其值为响应 URL 的变量。按照use variables as inputsdetailed sample 将此变量输出到后续任务。

【讨论】:

  • 感谢 Lance,一旦我的权限得到修复,我会尝试一下。现在我无法编辑/创建版本。我也将尝试这两个帖子中的方法:docs.microsoft.com/en-us/rest/api/logic/WorkflowTriggers/…mindbyte.nl/2019/02/13/…
  • 第一个链接是 Rest api 方式,当通过 Azure Devops PS 任务调用它时,它也应该适用于您。 Get-AzLogicAppTriggerCallbackUrl(电源命令)和Workflow Triggers都是官方推荐的方式:)
猜你喜欢
  • 1970-01-01
  • 2022-12-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-12-18
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多