Azure / Azure/logicapps

Bad Gateway when trying to get a vault secret within existing logic app

Open
#1,488 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
ABAP
Stars
424
Forks
320
Avg merge
14h 41m
Merged PRs (30d)
1

Description

### Severity

P3 - Medium (Minor functionality affected)

### Describe the Bug with repro steps

In an existing logic app I'm trying to obtain a key from the Azure key vault. I can do this in a new test app, but in my existing app, when I configure everything and add the Get Secret action, I get a greyed out "Bad Gateway" instead of a list of available secrets.

I expect to see the list of secrets that I see when I create a test app.

### What type of Logic App Is this happening in?

Consumption (Portal)

### Are you experiencing a regression?

_No response_

### Which operating system are you using?

Windows

### Did you refer to the TSG before filing this issue? https://aka.ms/lauxtsg

No

### Workflow JSON

```json
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"contentVersion": "1.0.0.0",
"triggers": {
"Recurrence_trigger": {
"type": "Recurrence",
"recurrence": {
"frequency": "Week",
"interval": 1,
"timeZone": "Eastern Standard Time",
"schedule": {
"hours": [
"8"
],
"minutes": [
0
],
"weekDays": [
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday"
]
}
}
}
},
"actions": {
"Get_Last_Modified_Date": {
"type": "ApiConnection",
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['sql-1']['connectionId']"
}
},
"method": "post",
"body": {},
"path": "/v2/datasets/@{encodeURIComponent(encodeURIComponent('intervarsity-azure.database.windows.net'))},@{encodeURIComponent(encodeURIComponent('VDGI3'))}/procedures/@{encodeURIComponent(encodeURIComponent('[dbo].[usp_GetMaxLastModifiedProject]'))}"
},
"runAfter": {
"Get_secret": [
"SUCCEEDED"
]
}
},
"HTTP_call_to_Virtuous": {
"type": "Http",
"inputs": {
"uri": "@{variables('varURI')}?skip=@{variables('varSkip')}&take=@{variables('varTake')}",
"method": "POST",
"headers": {
"Authorization": "Bearer xxxx"
},
"body": {
"groups": [
{
"conditions": [
{
"operator": "GreaterThan",
"parameter": "Last Modified Date",
"value": "@{variables('varLastModifiedUTC')}"
},
{
"operator": "IsKnown",
"parameter": "Report Level 1"
},
{
"operator": "IsNot",
"parameter": "Report Level 1",
"value": "Non-Reporting Projects"
}
]
}
]
}
},
"runAfter": {
"Set_some_variables": [
"Succeeded"
]
}
},
"Parse_JSON": {
"type": "ParseJson",
"inputs": {
"content": "@body('HTTP_call_to_Virtuous')",
"schema": {
"list": [
{
"beginningBalance": "",
"calendarYearToDateExpenseTotal": "",
"calendarYearToDateGiftCount": "",
"calendarYearToDateGiversCount": "",
"calendarYearToDateGiving": "",
"createDateTimeUtc": "",
"createdByUser": "",
"currentBalance": "",
"customFields": "",
"description": "",
"durationType": "",
"endDate": "",
"externalAccountingCode": "",
"financialNeedAmount": "",
"financialNeedFrequency": "",
"financialNeedType": "",
"giftSpecifications": [
{
"amount": "",
"frequency": ""
},
{
"amount": "",
"frequency": ""
}
],
"id": "",
"inventoryStatus": "",
"isActive": "",
"isAvailableOnline": "",
"isLimitedToFinancialNeed": "",
"isPublic": "",
"isRestrictedToGiftSpecifications": "",
"isSubProject": "",
"isTaxDeductible": "",
"lifeToDateExpenseTotal": "",
"lifeToDateGiftCount": "",
"lifeToDateGiversCount": "",
"lifeToDateGiving": "",
"location": "",
"modifiedByUser": "",
"modifiedDateTimeUtc": "",
"name": "",
"onlineDisplayName": "",
"parentId": "",
"parentName": "",
"photoUrl": "",
"projectCode": "",
"startDate": "",
"treatAsAccountsPayable": "",
"type": ""
},
{
"beginningBalance": "",
"calendarYearToDateExpenseTotal": "",
"calendarYearToDateGiftCount": "",
"calendarYearToDateGiversCount": "",
"calendarYearToDateGiving": "",
"createDateTimeUtc": "",
"createdByUser": "",
"currentBalance": "",
"customFields": "",
"description": "",
"durationType": "",
"endDate": "",
"externalAccountingCode": "",
"financialNeedAmount": "",
"financialNeedFrequency": "",
"financialNeedType": "",
"giftSpecifications": [
{
"amount": "",
"frequency": ""
},
{
"amount": "",
"frequency": ""
}
],
"id": "",
"inventoryStatus": "",
"isActive": "",
"isAvailableOnline": "",
"isLimitedToFinancialNeed": "",
"isPublic": "",
"isRestrictedToGiftSpecifications": "",
"isSubProject": "",
"isTaxDeductible": "",
"lifeToDateExpenseTotal": "",
"lifeToDateGiftCount": "",
"lifeToDateGiversCount": "",
"lifeToDateGiving": "",
"location": "",
"modifiedByUser": "",
"modifiedDateTimeUtc": "",
"name": "",
"onlineDisplayName": "",
"parentId": "",
"parentName": "",
"photoUrl": "",
"projectCode": "",
"startDate": "",
"treatAsAccountsPayable": "",
"type": ""
}
],
"total": ""
}
},
"runAfter": {
"HTTP_call_to_Virtuous": [
"Succeeded"
]
}
},
"Quit_if_there_are_no_project_records_returned": {
"type": "If",
"expression": {
"and": [
{
"greater": [
"@variables('varTotalRecs')",
0
]
}
]
},
"actions": {
"Until_skip_is_greater_than_total": {
"type": "Until",
"expression": "@greater(variables('varSkip'),variables('varTotalRecs'))",
"limit": {
"count": 200,
"timeout": "PT1H"
},
"actions": {
"HTTP_call_to_Virtuous_again": {
"type": "Http",
"inputs": {
"uri": "@{variables('varURI')}?skip=@{variables('varSkip')}&take=@{variables('varTake')}",
"method": "POST",
"headers": {
"Authorization": "Bearer xxxx"
},
"body": {
"groups": [
{
"conditions": [
{
"operator": "GreaterThan",
"parameter": "Last Modified Date",
"value": "@{variables('varLastModifiedUTC')}"
},
{
"operator": "IsKnown",
"parameter": "Report Level 1"
},
{
"operator": "IsNot",
"parameter": "Report Level 1",
"value": "Non-Reporting Projects"
}
]
}
]
}
},
"runAfter": {
"Increment_skip_var": [
"Succeeded"
]
}
},
"Increment_skip_var": {
"type": "IncrementVariable",
"inputs": {
"name": "varSkip"
},
"runAfter": {
"Write_JSON_to_SQL_Server": [
"Succeeded"
]
}
},
"Set_JSON_body_to_latest_call": {
"type": "SetVariable",
"inputs": {
"name": "varJSONBody",
"value": "@{body('HTTP_call_to_Virtuous_again')}"
},
"runAfter": {
"HTTP_call_to_Virtuous_again": [
"Succeeded"
]
}
},
"Write_JSON_to_SQL_Server": {
"type": "ApiConnection",
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['sql-1']['connectionId']"
}
},
"method": "post",
"path": "/v2/datasets/@{encodeURIComponent(encodeURIComponent('intervarsity-azure.database.windows.net'))},@{encodeURIComponent(encodeURIComponent('VDGI3'))}/procedures/@{encodeURIComponent(encodeURIComponent('usp_InhaleProjectJSON'))}"
}
}
}
}
},
"else": {
"actions": {}
},
"runAfter": {
"Get_total_recs_and_Body": [
"Succeeded"
]
}
},
"Get_total_recs_and_Body": {
"type": "InitializeVariable",
"inputs": {
"variables": [
{
"name": "varTotalRecs",
"type": "integer",
"value": "@body('Parse_JSON')?['total']"
},
{
"name": "varJSONBody",
"type": "string",
"value": "@{body('HTTP_call_to_Virtuous')}"
}
]
},
"runAfter": {
"Parse_JSON": [
"Succeeded"
]
}
},
"Set_some_variables": {
"type": "InitializeVariable",
"inputs": {
"variables": [
{
"name": "varLastModifiedUTC",
"type": "string",
"value": "@{body('Get_Last_Modified_Date')?['resultsets']?['Table1']?[0]?['LastModified']}"
},
{
"name": "varURI",
"type": "string",
"value": "https://api.virtuoussoftware.com/api/Project/Query"
},
{
"name": "varTake",
"type": "integer",
"value": 200
},
{
"name": "varSkip",
"type": "integer",
"value": 0
}
]
},
"runAfter": {
"Get_Last_Modified_Date": [
"Succeeded"
]
}
},
"Get_list_of_training_assessment_-_region_disagreement": {
"type": "ApiConnection",
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['sql-1']['connectionId']"
}
},
"method": "post",
"body": {},
"path": "/v2/datasets/@{encodeURIComponent(encodeURIComponent('intervarsity-azure.database.windows.net'))},@{encodeURIComponent(encodeURIComponent('VDGI3'))}/procedures/@{encodeURIComponent(encodeURIComponent('usp_GetInvalidProjects_TrainingDisagreement'))}"
},
"runAfter": {
"Quit_if_there_are_no_project_records_returned": [
"Succeeded"
]
}
},
"Are_all_training_regions_up_to_date": {
"type": "If",
"expression": {
"and": [
{
"equals": [
"@length(body('Get_list_of_training_assessment_-_region_disagreement')?['ResultSets']['Table1'])\r\n",
0
]
}
]
},
"actions": {},
"else": {
"actions": {
"For_each-training_disagreement": {
"type": "Foreach",
"foreach": "@body('Get_list_of_training_assessment_-_region_disagreement')?['resultsets']?['Table1']",
"actions": {
"Compose_training_region_row": {
"type": "Compose",
"inputs": "@{items('For_each-training_disagreement')['ProjectCode']}@{item()?['TrainingRegion']}@{item()?['TrainingPercent']}"
},
"Append_to_bad_training_regions": {
"type": "AppendToArrayVariable",
"inputs": {
"name": "varFaultyTrainingRegion",
"value": "@outputs('Compose_training_region_row')"
},
"runAfter": {
"Compose_training_region_row": [
"Succeeded"
]
}
}
}
},
"Compose_email_body_for_faulty_training_region": {
"type": "Compose",
"inputs": "@{join(variables('varFaultyTrainingRegion'),'')}ProjectTrain RegionPercent",
"runAfter": {
"For_each-training_disagreement": [
"Succeeded"
]
}
},
"Send_the_training_region_email": {
"type": "ApiConnection",
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['office365-1']['connectionId']"
}
},
"method": "post",
"body": {
"To": "finance@ivcf.ca;infomanagement@ivcf.ca",
"Subject": "VDGI: Projects with training/region disagreements",
"Body": "

Hello VDGI Admin,
There are some projects that require your attention in order for VDGI to run properly at month-end. These projects have a training percent specified but no training region has been selected.
Use the VDGI Project Editor to make these changes.
@{outputs('Compose_email_body_for_faulty_training_region')}


Generated from the Azure Logic app \"get-virtuous-projects-vdgi3\"

",
"From": "automailer@ivcf.ca",
"ReplyTo": "infomanagement@ivcf.ca",
"Importance": "Normal"
},
"path": "/v2/Mail"
},
"runAfter": {
"Compose_email_body_for_faulty_training_region": [
"Succeeded"
]
}
}
}
},
"runAfter": {
"Initialize_variable_for_bad_training_regions": [
"Succeeded"
]
}
},
"Get_list_of_invalid_projects": {
"type": "ApiConnection",
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['sql-1']['connectionId']"
}
},
"method": "post",
"body": {},
"path": "/v2/datasets/@{encodeURIComponent(encodeURIComponent('intervarsity-azure.database.windows.net'))},@{encodeURIComponent(encodeURIComponent('VDGI3'))}/procedures/@{encodeURIComponent(encodeURIComponent('usp_GetInvalidProjectList'))}"
},
"runAfter": {
"Quit_if_there_are_no_project_records_returned": [
"Succeeded"
]
}
},
"Initialize_invalid_projects_array": {
"type": "InitializeVariable",
"inputs": {
"variables": [
{
"name": "varInvalidProjects",
"type": "array"
}
]
},
"runAfter": {
"Get_list_of_invalid_projects": [
"Succeeded"
]
}
},
"Initialize_variable_for_bad_training_regions": {
"type": "InitializeVariable",
"inputs": {
"variables": [
{
"name": "varFaultyTrainingRegion",
"type": "array"
}
]
},
"runAfter": {
"Get_list_of_training_assessment_-_region_disagreement": [
"Succeeded"
]
}
},
"Are_all_projects_up_to_date_": {
"type": "If",
"expression": {
"and": [
{
"equals": [
"@length(body('Get_list_of_invalid_projects')?['resultsets']?['Table1'])",
0
]
}
]
},
"actions": {},
"else": {
"actions": {
"For_each_invalid_project": {
"type": "Foreach",
"foreach": "@body('Get_list_of_invalid_projects')?['resultsets']?['Table1']",
"actions": {
"Compose_invalid_project_row": {
"type": "Compose",
"inputs": "@{item()?['Description']}@{item()?['ProjectCode']}@{item()?['Since']}@{item()?['DaysOutstanding']}"
},
"Append_to_array_variable": {
"type": "AppendToArrayVariable",
"inputs": {
"name": "varInvalidProjects",
"value": "@outputs('Compose_invalid_project_row')"
},
"runAfter": {
"Compose_invalid_project_row": [
"Succeeded"
]
}
},
"Max_Days_Allowed": {
"type": "If",
"expression": {
"and": [
{
"greater": [
"@int(item()?['DaysOutstanding'])",
"@variables('varMaxDaysOutstanding')"
]
}
]
},
"actions": {
"Set_variable_-_Max_Days_Outstanding": {
"type": "SetVariable",
"inputs": {
"name": "varMaxDaysOutstanding",
"value": "@int(item()?['DaysOutstanding'])"
}
}
},
"else": {
"actions": {}
},
"runAfter": {
"Append_to_array_variable": [
"Succeeded"
]
}
}
}
},
"Compose_email_body_for_invalid_projects": {
"type": "Compose",
"inputs": "@{join(variables('varInvalidProjects'),'')}ProjectCodeCreatedDays Outstanding",
"runAfter": {
"For_each_invalid_project": [
"Succeeded"
]
}
},
"Send_the_invalid_project_email": {
"type": "ApiConnection",
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['office365-1']['connectionId']"
}
},
"method": "post",
"body": {
"To": "infomanagement@ivcf.ca;finance@ivcf.ca",
"Subject": "@if(less(variables('varMaxDaysOutstanding'), 14), 'VDGI: Projects with missing data', 'OUTSTANDING ISSUE: VDGI Projects with missing data')",
"Body": "

Hello VDGI Admin,
There are some projects that require your attention in order for VDGI to run properly at month-end. This list of projects has one or more data point that needs to be addressed.
Use the VDGI Project Editor to make these changes.
@{outputs('Compose_email_body_for_invalid_projects')}


Generated from the Azure Logic app \"get-virtuous-projects-vdgi3\"

",
"From": "automailer@ivcf.ca",
"ReplyTo": "infomanagement@ivcf.ca",
"Importance": "@if(greaterOrEquals(variables('varMaxDaysOutstanding'), 14), 'High', 'Normal')"
},
"path": "/v2/Mail"
},
"runAfter": {
"Compose_email_body_for_invalid_projects": [
"Succeeded"
]
}
}
}
},
"runAfter": {
"Initialize_Max_Days_Outstanding": [
"Succeeded"
]
}
},
"Initialize_Max_Days_Outstanding": {
"type": "InitializeVariable",
"inputs": {
"variables": [
{
"name": "varMaxDaysOutstanding",
"type": "integer",
"value": 0
}
]
},
"runAfter": {
"Initialize_invalid_projects_array": [
"Succeeded"
]
}
},
"Get_secret": {
"type": "ApiConnection",
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['keyvault']['connectionId']"
}
},
"method": "get",
"path": "/secrets/@{encodeURIComponent('')}/value"
},
"runAfter": {},
"runtimeConfiguration": {
"secureData": {
"properties": [
"inputs",
"outputs"
]
}
}
}
},
"outputs": {},
"parameters": {
"$connections": {
"type": "Object",
"defaultValue": {}
}
}
},
"parameters": {
"$connections": {
"type": "Object",
"value": {
"sql-1": {
"id": "/subscriptions/4c75c1e9-7a79-4ee5-b538-994b35be4279/providers/Microsoft.Web/locations/canadacentral/managedApis/sql",
"connectionId": "/subscriptions/4c75c1e9-7a79-4ee5-b538-994b35be4279/resourceGroups/DefaultResourceGroup-CCAN/providers/Microsoft.Web/connections/sql-2",
"connectionName": "sql-2",
"connectionProperties": {
"authentication": {
"type": "ManagedServiceIdentity"
}
}
},
"office365-1": {
"id": "/subscriptions/4c75c1e9-7a79-4ee5-b538-994b35be4279/providers/Microsoft.Web/locations/canadacentral/managedApis/office365",
"connectionId": "/subscriptions/4c75c1e9-7a79-4ee5-b538-994b35be4279/resourceGroups/DefaultResourceGroup-CCAN/providers/Microsoft.Web/connections/office365-1",
"connectionName": "office365-1"
},
"keyvault": {
"id": "/subscriptions/4c75c1e9-7a79-4ee5-b538-994b35be4279/providers/Microsoft.Web/locations/canadacentral/managedApis/keyvault",
"connectionId": "/subscriptions/4c75c1e9-7a79-4ee5-b538-994b35be4279/resourceGroups/DefaultResourceGroup-CCAN/providers/Microsoft.Web/connections/keyvault-1",
"connectionName": "keyvault-1",
"connectionProperties": {
"authentication": {
"type": "ManagedServiceIdentity"
}
}
}
}
}
}
}
```

### Screenshots or Videos

Image

### Environment

Browser: Microsoft Edge Version 139.0.3405.111 (Official build) (64-bit)

### Additional context

_No response_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.