Azure / logicapps

Azure Logic Apps labs, samples, and tools
MIT License
368 stars 302 forks source link

FMIntakeEmailRspns #1213

Open JulianRamon-FAS opened 1 month ago

JulianRamon-FAS commented 1 month ago

Describe the Bug with repro steps

Receiving a bad gateway but I have access as I am the admin of the entire tenant, don't understand but when I use a known good older connection profile with the same credentials, it works.

{ "Message": "The backend request failed with error code '400'", "Reason": "{\"status\":400,\"source\":\"https://logic-apis-eastus.consent.azure-apim.net:443/api/tokens/exchange?api-version=2015-11-01-preview\",\"message\":\"Failed to retrieve token for resource=https%253A%252F%252Forg541695ce.crm.dynamics.com. Message={\\"error\\":\\"invalid_resource\\",\\"error_description\\":\\"AADSTS500011: The resource principal named https%253A%252F%252Forg541695ce.crm.dynamics.com was not found in the tenant named Ferrandino & Son, Inc. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You might have sent your authentication request to the wrong tenant. Trace ID: 5ff311e1-cb81-4e16-9889-3b871deb4000 Correlation ID: 28b901f4-6740-4f8c-9731-4bf8a6d33834 Timestamp: 2024-10-18 16:26:40Z\\",\\"error_codes\\":[500011],\\"timestamp\\":\\"2024-10-18 16:26:40Z\\",\\"trace_id\\":\\"5ff311e1-cb81-4e16-9889-3b871deb4000\\",\\"correlation_id\\":\\"28b901f4-6740-4f8c-9731-4bf8a6d33834\\",\\"error_uri\\":\\"https://login.microsoftonline.com/error?code=500011\\"}\"}", "OperationId": "ListRecords", "ClientRequestId": "d13ffa66-2bf3-4cfc-ac87-32bb393aec90", "ClientRequestUrl": "https://logic-apis-eastus.azure-apim.net/apim/commondataservice/b5e24634fd2b40c5bc796accbb452085/api/data/v9.1/cr037_storelocations?%24top=2" }

What type of Logic App Is this happening in?

Consumption (Portal)

Which operating system are you using?

Windows

Are you using new designer or old designer

New Designer

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

Yes

Workflow JSON

{ "definition": { "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#", "actions": { "ComposeConcat": { "inputs": "@concat(outputs('ComposeType'), '-', outputs('ComposeWonum'), '-', outputs('ComposeDate'))", "runAfter": { "ComposeDate": [ "Succeeded" ] }, "type": "Compose" }, "ComposeDate": { "inputs": "@formatDateTime(triggerOutputs()?['body/receivedDateTime'], 'MM/dd/yyyy')", "runAfter": { "ComposeWonum": [ "Succeeded" ] }, "type": "Compose" }, "ComposeFrom": { "inputs": "@triggerBody()?['from']", "runAfter": { "ComposeConcat": [ "Succeeded" ] }, "type": "Compose" }, "ComposeType": { "inputs": "@if(contains(toLower(triggerOutputs()?['body/subject']), 're: ferrandino -schedule date request'), 'PndSchd',\r\nif(contains(toLower(triggerOutputs()?['body/subject']), 're: ferrandino -proposal request'), 'PndPrpsl',\r\nif(contains(toLower(triggerOutputs()?['body/subject']), 're: ferrandino -material update'), 'PndVndMtrl',\r\nif(contains(toLower(triggerOutputs()?['body/subject']), 're: ferrandino -confirm completion'), 'CnfrmCmplt',\r\nif(contains(toLower(triggerOutputs()?['body/subject']), 're: ferrandino -schedule confirmation'), 'NxtDyCnfrm',\r\n'Unknown')))))", "runAfter": {}, "type": "Compose" }, "ComposeWonum": { "inputs": "@substring(triggerOutputs()?['body/subject'], add(length(triggerOutputs()?['body/subject']), -7), 7)", "runAfter": { "ComposeType": [ "Succeeded" ] }, "type": "Compose" }, "Condition": { "actions": { "ComposeRowID": { "inputs": "@first(outputs('List_rows')?['body/value'])?['cr037_fmworkflowdataid']", "runAfter": { "List_rows": [ "Succeeded" ] }, "type": "Compose" }, "List_rows": { "inputs": { "headers": { "accept": "application/json;odata.metadata=full", "organization": "@{encodeURIComponent(encodeURIComponent('https://org541695ce.crm.dynamics.com'))}", "prefer": "odata.include-annotations=" }, "host": { "connection": { "name": "@parameters('$connections')['commondataservice-1']['connectionId']" } }, "method": "get", "path": "/api/data/v9.1/@{encodeURIComponent(encodeURIComponent('cr037_fmworkflowdatas'))}", "queries": { "$filter": "cr037_concattypewonumdate eq '@{outputs('ComposeConcat')}'" } }, "runAfter": { "List_rows_1": [ "Succeeded" ] }, "type": "ApiConnection" }, "List_rows_1": { "inputs": { "headers": { "accept": "application/json;odata.metadata=full", "organization": "@{encodeURIComponent(encodeURIComponent('https://org541695ce.crm.dynamics.com'))}", "prefer": "odata.include-annotations=" }, "host": { "connection": { "name": "@parameters('$connections')['commondataservice-1']['connectionId']" } }, "method": "get", "path": "/api/data/v9.1/@{encodeURIComponent(encodeURIComponent('cr037_storelocations'))}", "queries": { "$top": 2 } }, "runAfter": {}, "type": "ApiConnection" }, "Update_a_row": { "inputs": { "headers": { "accept": "application/json;odata.metadata=full", "organization": "@{encodeURIComponent(encodeURIComponent('https://org541695ce.crm.dynamics.com'))}", "prefer": "return=representation,odata.include-annotations=" }, "host": { "connection": { "name": "@parameters('$connections')['commondataservice']['connectionId']" } }, "method": "patch", "path": "/api/data/v9.1/@{encodeURIComponent(encodeURIComponent('cr037_fmworkflowdatas'))}(@{encodeURIComponent(encodeURIComponent(outputs('ComposeRowID')))})" }, "runAfter": { "ComposeRowID": [ "Succeeded" ] }, "type": "ApiConnection" } }, "expression": { "and": [ { "not": { "contains": [ "@triggerBody()?['from']", "ferrandinoandson.com" ] } } ] }, "runAfter": { "List_rows_2": [ "Succeeded" ] }, "type": "If" }, "List_rows_2": { "inputs": { "headers": { "accept": "application/json;odata.metadata=full", "organization": "https://org541695ce.crm.dynamics.com", "prefer": "odata.include-annotations=" }, "host": { "connection": { "name": "@parameters('$connections')['commondataservice']['connectionId']" } }, "method": "get", "path": "/api/data/v9.1/@{encodeURIComponent(encodeURIComponent('cr037_fmworkflowdatas'))}", "queries": { "$top": 2 } }, "runAfter": { "ComposeFrom": [ "Succeeded" ] }, "type": "ApiConnection" } }, "contentVersion": "1.0.0.0", "outputs": {}, "parameters": { "$connections": { "defaultValue": {}, "type": "Object" } }, "triggers": { "When_a_new_email_arrives_in_a_sharedmailbox(V2)": { "evaluatedRecurrence": { "frequency": "Minute", "interval": 3 }, "inputs": { "host": { "connection": { "name": "@parameters('$connections')['office365']['connectionId']" } }, "method": "get", "path": "/v2/SharedMailbox/Mail/OnNewEmail", "queries": { "folderId": "Id::AAMkADQ5ZmRlMmUxLWZlODYtNGViOS05MjIyLTBkZjI5OGFiNjQ0ZAAuAAAAAAChgVTpTDXzRLFNrTldQ6eFAQB8E7i0oMFXSonVqYFlcU02AADNZmj1AAA=", "hasAttachments": false, "importance": "Any", "includeAttachments": false, "mailboxAddress": "intake@ferrandinoandson.com", "subjectFilter": ": Ferrandino -" } }, "metadata": { "Id::AAMkADQ5ZmRlMmUxLWZlODYtNGViOS05MjIyLTBkZjI5OGFiNjQ0ZAAuAAAAAAChgVTpTDXzRLFNrTldQ6eFAQB8E7i0oMFXSonVqYFlcU02AADNZmj1AAA=": "RE:" }, "recurrence": { "frequency": "Minute", "interval": 3 }, "splitOn": "@triggerBody()?['value']", "type": "ApiConnection" } } }, "parameters": { "$connections": { "value": { "commondataservice": { "connectionId": "/subscriptions/22889fb8-f09a-471e-8627-3a6dd1ecbae2/resourceGroups/em-adtintake-prod/providers/Microsoft.Web/connections/commondataservice-1", "connectionName": "commondataservice-1", "id": "/subscriptions/22889fb8-f09a-471e-8627-3a6dd1ecbae2/providers/Microsoft.Web/locations/eastus/managedApis/commondataservice" }, "commondataservice-1": { "connectionId": "/subscriptions/22889fb8-f09a-471e-8627-3a6dd1ecbae2/resourceGroups/em-adtintake-prod/providers/Microsoft.Web/connections/commondataservice-6", "connectionName": "commondataservice-6", "id": "/subscriptions/22889fb8-f09a-471e-8627-3a6dd1ecbae2/providers/Microsoft.Web/locations/eastus/managedApis/commondataservice" }, "office365": { "connectionId": "/subscriptions/22889fb8-f09a-471e-8627-3a6dd1ecbae2/resourceGroups/em-adtintake-prod/providers/Microsoft.Web/connections/office365-7", "connectionName": "office365-7", "id": "/subscriptions/22889fb8-f09a-471e-8627-3a6dd1ecbae2/providers/Microsoft.Web/locations/eastus/managedApis/office365" } } } } }

Screenshots or Videos

No response

Browser

Edge

Additional context

No response