rifaterdemsahin / azurelogicappemailsupport

email support ticket repo
0 stars 0 forks source link

Azure Support Elaboration #1

Open rifaterdemsahin opened 10 months ago

rifaterdemsahin commented 10 months ago

Goal: To be able to use the array variable and add the blob data into the variable Blocker: We can not append the blob items and send it an email using the components in Azure logic apps Support Ticket: 2308250050001183 https://portal.azure.com/#view/Microsoft_Azure_Support/SupportRequestDetails.ReactView/id/%2Fsubscriptions%2F15704bda-bb65-45ef-bd84-55b56bb32733%2Fproviders%2Fmicrosoft.support%2Fsupporttickets%2F2308250050001183/portalJourney~/true

image

Support Assigned :

image

End Goal: Based on logic have each array constructed in a way to have different types of attachments

image

The logic app run

image

A basic logic app that was created to send emails

image

The component works if we do not use arrays

image

Initialize the array variable and set the variable

image

The reference in Azure https://portal.azure.com/#@pexabo.com/resource/subscriptions/15704bda-bb65-45ef-bd84-55b56bb32733/resourceGroups/sendemailattachmentssupport_group/providers/Microsoft.Logic/workflows/sendemailattachmentssupport/logicApp

Components in Logic apps to read the blob and send email connectors

image

WorkflowView SendEmailSupportLogicApp

image image

This fails when the attachment is here ( the main location of the problem )

image

Code View SendEmailSupportLogicApp

{
    "definition": {
        "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
        "actions": {
            "Condition_go_to_false_for_support_testing": {
                "actions": {
                    "Send_email_(V2)_gmail_direct_attachments_works": {
                        "inputs": {
                            "body": {
                                "Attachments": [
                                    {
                                        "ContentBytes": "@{base64(body('Get_blob_content_(V2)'))}",
                                        "ContentType": "docx",
                                        "Name": "cv.docx"
                                    }
                                ],
                                "Body": "<p>lets pray tpo attach and see the attachment on the other side<br>\n</p>",
                                "Subject": "testing with support",
                                "To": "rifaterdemsahin@hotmail.com"
                            },
                            "host": {
                                "connection": {
                                    "name": "@parameters('$connections')['gmail']['connectionId']"
                                }
                            },
                            "method": "post",
                            "path": "/v2/Mail"
                        },
                        "runAfter": {},
                        "type": "ApiConnection"
                    },
                    "Send_email_(V2)_with_variable_it_does_not_work_": {
                        "inputs": {
                            "body": {
                                "Attachments": "outputs(@variables('attachments')) ",
                                "Body": "<p>xxx<br>\ntoday test &gt;&gt;&gt; 20 October 2023</p>",
                                "Subject": "xxxx- 5",
                                "To": "rifaterdemsahin@hotmail.com"
                            },
                            "host": {
                                "connection": {
                                    "name": "@parameters('$connections')['gmail']['connectionId']"
                                }
                            },
                            "method": "post",
                            "path": "/v2/Mail"
                        },
                        "runAfter": {
                            "Set_variable_attachements": [
                                "Succeeded"
                            ]
                        },
                        "type": "ApiConnection"
                    },
                    "Set_variable_attachements": {
                        "inputs": {
                            "name": "attachments",
                            "value": [
                                {
                                    "Attachment Content": "@{body('Get_blob_content_(V2)')}",
                                    "Name": "fileName1.docx",
                                    "Type": "docx"
                                },
                                {
                                    "Attachment Content": "@{body('Get_blob_content_(V2)')}",
                                    "Name": "fileName2.docx",
                                    "Type": "docx"
                                }
                            ]
                        },
                        "runAfter": {
                            "Send_email_(V2)_gmail_direct_attachments_works": [
                                "Succeeded"
                            ]
                        },
                        "type": "SetVariable"
                    }
                },
                "else": {
                    "actions": {
                        "Append_to_array_variable_1_(attach)": {
                            "inputs": {
                                "name": "attachments",
                                "value": "[\n    \"ContentBytes\": \"@{body('Get_blob_content_(V2)')}\",\n    \"Name\": \"fileName1.docx\"\n  ]"
                            },
                            "runAfter": {},
                            "type": "AppendToArrayVariable"
                        },
                        "Append_to_array_variable_2_(attach)": {
                            "inputs": {
                                "name": "attachments",
                                "value": "[\n    \"ContentBytes\": \"@{body('Get_blob_content_(V2)')}\",\n    \"Name\": \"fileName1.docx\"\n  ]"
                            },
                            "runAfter": {
                                "Append_to_array_variable_1_(attach)": [
                                    "Succeeded"
                                ]
                            },
                            "type": "AppendToArrayVariable"
                        },
                        "Compose": {
                            "inputs": "@variables('attachments')",
                            "runAfter": {
                                "Append_to_array_variable_2_(attach)": [
                                    "Succeeded"
                                ]
                            },
                            "type": "Compose"
                        },
                        "Send_email_(V2)": {
                            "inputs": {
                                "body": {
                                    "Attachments": "@outputs('Compose')[0]",
                                    "Body": "<p>x10</p>",
                                    "Subject": "x10- 3 rd nov-pray for output",
                                    "To": "rifaterdemsahin@hotmail.com"
                                },
                                "host": {
                                    "connection": {
                                        "name": "@parameters('$connections')['gmail']['connectionId']"
                                    }
                                },
                                "method": "post",
                                "path": "/v2/Mail"
                            },
                            "runAfter": {
                                "Compose": [
                                    "Succeeded"
                                ]
                            },
                            "type": "ApiConnection"
                        }
                    }
                },
                "expression": {
                    "and": [
                        {
                            "equals": [
                                false,
                                true
                            ]
                        }
                    ]
                },
                "runAfter": {
                    "Initialize_variable_attahments": [
                        "Succeeded"
                    ]
                },
                "type": "If"
            },
            "Get_blob_content_(V2)": {
                "inputs": {
                    "host": {
                        "connection": {
                            "name": "@parameters('$connections')['azureblob']['connectionId']"
                        }
                    },
                    "method": "get",
                    "path": "/v2/datasets/@{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/files/@{encodeURIComponent(encodeURIComponent('JTJmZW1haWxzJTJmRXJkZW0rU2FoaW4rRGV2T3BzK0NWKy5kb2N4'))}/content",
                    "queries": {
                        "inferContentType": true
                    }
                },
                "metadata": {
                    "JTJmZW1haWxzJTJmRXJkZW0rU2FoaW4rRGV2T3BzK0NWKy5kb2N4": "/emails/Erdem Sahin DevOps CV .docx"
                },
                "runAfter": {
                    "Initialize_variable_showcasefor_support": [
                        "Succeeded"
                    ]
                },
                "type": "ApiConnection"
            },
            "Initialize_variable_attahments": {
                "inputs": {
                    "variables": [
                        {
                            "name": "attachments",
                            "type": "array",
                            "value": []
                        }
                    ]
                },
                "runAfter": {
                    "Get_blob_content_(V2)": [
                        "Succeeded"
                    ]
                },
                "type": "InitializeVariable"
            },
            "Initialize_variable_showcasefor_support": {
                "inputs": {
                    "variables": [
                        {
                            "name": "itdidnotworkshowittosupport",
                            "type": "boolean",
                            "value": false
                        }
                    ]
                },
                "runAfter": {},
                "type": "InitializeVariable"
            }
        },
        "contentVersion": "1.0.0.0",
        "outputs": {},
        "parameters": {
            "$connections": {
                "defaultValue": {},
                "type": "Object"
            }
        },
        "triggers": {
            "Recurrence": {
                "evaluatedRecurrence": {
                    "frequency": "Month",
                    "interval": 4
                },
                "recurrence": {
                    "frequency": "Month",
                    "interval": 4
                },
                "type": "Recurrence"
            }
        }
    },
    "parameters": {
        "$connections": {
            "value": {
                "azureblob": {
                    "connectionId": "/subscriptions/15704bda-bb65-45ef-bd84-55b56bb32733/resourceGroups/sendemailattachmentssupport_group/providers/Microsoft.Web/connections/azureblob",
                    "connectionName": "azureblob",
                    "id": "/subscriptions/15704bda-bb65-45ef-bd84-55b56bb32733/providers/Microsoft.Web/locations/eastus/managedApis/azureblob"
                },
                "gmail": {
                    "connectionId": "/subscriptions/15704bda-bb65-45ef-bd84-55b56bb32733/resourceGroups/sendemailattachmentssupport_group/providers/Microsoft.Web/connections/gmail",
                    "connectionName": "gmail",
                    "id": "/subscriptions/15704bda-bb65-45ef-bd84-55b56bb32733/providers/Microsoft.Web/locations/eastus/managedApis/gmail"
                }
            }
        }
    }
}

Document the images in the video https://www.loom.com/share/13fb29f957db4911820019c8cc5cae51

Reference WordPress https://rifaterdemsahin.com/2023/11/24/azure-support-elaboration-email-attachments/

Reference to Microsoft Issue GitHub https://github.com/MicrosoftDocs/azure-docs/issues/116747

rifaterdemsahin commented 10 months ago

Video of the demonstration in mp4 file >> https://github.com/rifaterdemsahin/azurelogicappemailsupport/blob/main/20-october-2023-logic-apps-can-not-attach-multiple-embeds-with-array-variable-2_FhobiWmY.mp4

Download to watch ^^^

zip files using Canva to do it https://www.canva.com/design/DAF1C_bfbfE/NDcqjZrfK6gIIs9oMIjHcg/edit?utm_content=DAF1C_bfbfE&utm_campaign=designshare&utm_medium=link2&utm_source=sharebutton

Also splitting with mp4 splitter https://clideo.com/mp4-splitter

Maybe using davinci is easier https://forum.blackmagicdesign.com/viewtopic.php?f=21&t=148679

rifaterdemsahin commented 10 months ago

Last session reference

image

[07:11] Rifat Erdem Sahin Latest state > https://www.loom.com/share/13fb29f957db4911820019c8cc5cae51 [07:12] Rifat Erdem Sahin https://github.com/MicrosoftDocs/azure-docs/issues/116747 [07:15] Rifat Erdem Sahin https://rifaterdemsahin.com/2023/11/24/azure-support-elaboration-email-attachments/ [07:17] Rifat Erdem Sahin https://github.com/rifaterdemsahin/logicapps [07:18] Rifat Erdem Sahin please retry https://github.com/rifaterdemsahin/azurelogicappemailsupport [07:19] Rifat Erdem Sahin https://github.com/rifaterdemsahin/azurelogicappemailsupport/issues/1 [07:23] Rifat Erdem Sahin https://github.com/MicrosoftDocs/azure-docs/issues/116747 The email arrays are not working >> The system fails to get the array variables tested here and it fails · Issue #116747 · MicrosoftDocs/azure-docs https://github.com/MicrosoftDocs/azure-docs/blob/main/articles/logic-apps/logic-apps-control-flow-loops.md The array structure does not work here is the video https://www.loom.com/share/84784e6bdd3... [07:52] 07:52 Call ended 42m 28s

[08:01] Rifat Erdem Sahin here is the video https://github.com/rifaterdemsahin/azurelogicappemailsupport/blob/main/20-october-2023-logic-apps-can-not-attach-multiple-embeds-with-array-variable-2_FhobiWmY.mp4 azurelogicappemailsupport/20-october-2023-logic-apps-can-not-attach-multiple-embeds-with-array-variable-2_FhobiWmY.mp4 at main · rifaterdemsahin/azurelogicappemailsupport email support ticket repo. Contribute to rifaterdemsahin/azurelogicappemailsupport development by creating an account on GitHub.

rifaterdemsahin commented 10 months ago

Talking on x still not at the same page

image