Skip to content

Instantly share code, notes, and snippets.

@stefanstranger
Created July 9, 2023 14:01
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stefanstranger/a889ea7ce095c9b978c7af06c554ddee to your computer and use it in GitHub Desktop.
Save stefanstranger/a889ea7ce095c9b978c7af06c554ddee to your computer and use it in GitHub Desktop.
Example Logic App Markdown document

Azure Logic App Documentation - logic-jiraintegration-demo

Introduction

This document describes the Azure Logic App Workflow logic-jiraintegration-demo in the jiraintegration-demo-rg resource group in the Internal Subscription subscription.

This document is programmatically generated using a PowerShell script.

Date: 2023-07-09 15:53:39

Logic App Workflow Diagram

graph TB
    Trigger
    subgraph Condition_-_Status-False
    direction TB
        Compose_-_Resolved_-_Current_Item
        For_Each_-_JIRA_SHA_Incident
        HTTP_-_Get_all_Active_JIRA_SHA_Incidents
        Parse_JSON_-_HTTP_-_Get_all_Active_JIRA_SHA_Incidents
    end
    subgraph Condition_-_Status-True
    direction TB
        Compose_-_Current_Item
        Compose_-_SHA_TimeGeneratedUTC
        Compose_-_Subscriptions_Array
        Create_a_new_issue_V2
        Html_to_text_-_Summary_Communication
    end
    subgraph Condition-True
    direction TB
        HTTP_-_Close_JIRA_SHA_Incident
    end
    subgraph For_Each_-_JIRA_SHA_Incident
    direction TB
        Compose_-_Current_JIRA_SHA_Incident
        Compose_-_JIRA_Incident_Id
        Compose_-_TICKET_ID_Number
        Condition
    end
    subgraph For_Each_-_SHA
    direction TB
        Condition_-_Status
    end
    Parse_JSON_-_Log_Analytics_Search_Query --> For_Each_-_SHA
    For_Each_-_SHA --> Condition_-_Status
    Compose_-_SHA_TimeGeneratedUTC --> Compose_-_Current_Item
    Condition_-_Status --> Compose_-_SHA_TimeGeneratedUTC
    Compose_-_Current_Item --> Compose_-_Subscriptions_Array
    Html_to_text_-_Summary_Communication --> Create_a_new_issue_V2
    Compose_-_Subscriptions_Array --> Html_to_text_-_Summary_Communication
    Condition_-_Status --> Compose_-_Resolved_-_Current_Item
    Parse_JSON_-_HTTP_-_Get_all_Active_JIRA_SHA_Incidents --> For_Each_-_JIRA_SHA_Incident
    For_Each_-_JIRA_SHA_Incident --> Compose_-_Current_JIRA_SHA_Incident
    Compose_-_TICKET_ID_Number --> Compose_-_JIRA_Incident_Id
    Compose_-_Current_JIRA_SHA_Incident --> Compose_-_TICKET_ID_Number
    Compose_-_JIRA_Incident_Id --> Condition
    Condition --> HTTP_-_Close_JIRA_SHA_Incident
    Compose_-_Resolved_-_Current_Item --> HTTP_-_Get_all_Active_JIRA_SHA_Incidents
    HTTP_-_Get_all_Active_JIRA_SHA_Incidents --> Parse_JSON_-_HTTP_-_Get_all_Active_JIRA_SHA_Incidents
    Run_query_and_list_results --> Parse_JSON_-_Log_Analytics_Search_Query
    Parse_JSON --> Run_query_and_list_results
    Trigger --> Parse_JSON

Logic App Workflow Actions

This section shows an overview of Logic App Workflow actions and their dependencies.

Actions

ActionName Type RunAfter Inputs
Parse_JSON ParseJson
{
"content": "@triggerBody()",
"schema": {
"properties": {
"data": "@{properties=; type=object}",
"schemaId": "@{type=string}"
},
"type": "object"
}
}
Run_query_and_list_results ApiConnection Parse_JSON
{
"body": "@{body('Parse_JSON')['data']['alertContext']['Condition']['allOf'][0]['searchQuery']}",
"host": {
"connection": {
"name": "@parameters('$connections')['azuremonitorlogs']['connectionId']"
}
},
"method": "post",
"path": "/queryData",
"queries": {
"resourcegroups": "la-demo-rg",
"resourcename": "la-demo-workspace",
"resourcetype": "Log Analytics Workspace",
"subscriptions": "3c20ccf5-16da-469c-8b3b-219de5e4a054",
"timerange": "Last hour"
}
}
Parse_JSON_-_Log_Analytics_Search_Query ParseJson Run_query_and_list_results
{
"content": "@body('Run_query_and_list_results')",
"schema": {
"properties": {
"AZURE_SERVICE": "@{type=string}",
"IMPACT": "@{type=string}",
"JIRA_ASSIGNMENT_GROUP": "@{type=string}",
"JIRA_COMPONENT_NAME": "@{type=string}",
"SUMMARY_Communication": "@{type=string}",
"SUMMARY_Title": "@{type=string}",
"Status": "@{type=string}",
"Subscriptions": "@{type=string}",
"TICKET_ID_Number": "@{type=string}",
"TimeGenerated": "@{type=string}"
},
"type": "object"
}
}
For_Each_-_SHA Foreach Parse_JSON_-_Log_Analytics_Search_Query null
Condition_-_Status If For_Each_-_SHA null
Compose_-_SHA_TimeGeneratedUTC Compose Condition_-_Status-True "@items('For Each - SHA')?['TimeGeneratedUTC']"
Compose_-_Current_Item Compose Compose_-_SHA_TimeGeneratedUTC "@items('For Each - SHA')"
Compose_-_Subscriptions_Array Compose Compose_-_Current_Item "@array(items('For Each - SHA').Subscriptions)"
Html_to_text_-_Summary_Communication ApiConnection Compose_-_Subscriptions_Array
{
"body": "

@{items('For Each - SHA')?['SUMMARY_Communication']}

",
"host": {
"connection": {
"name": "@parameters('$connections')['conversionservice']['connectionId']"
}
},
"method": "post",
"path": "/html2text"
}
Create_a_new_issue_V2 ApiConnection Html_to_text_-_Summary_Communication
{
"body": {
"fields": {
"customfield_10041": "Azure",
"customfield_10065": "@items('For Each - SHA')?['JIRA_ASSIGNMENT_GROUP']",
"description": "Azure Service Health Issue\n\nStatus: @{items('For Each - SHA')?['Status']} \nStart Time: @{items('For Each - SHA')?['TimeGeneratedUTC']}\nSummary of Impact: @{body('Html to text - Summary Communication')}\nTracking ID: @{items('For Each - SHA')?['TICKET_ID_Number']}\nImpacted Services: @{items('For Each - SHA')?['AZURE_SERVICE']}\nImpacted Subscriptions: @{items('For Each - SHA')?['Subscriptions']}",
"summary": "@{items('For Each - SHA')?['SUMMARY_Title']} - @{items('For Each - SHA')?['TICKET_ID_Number']}"
}
},
"host": {
"connection": {
"name": "@parameters('$connections')['jira']['connectionId']"
}
},
"method": "post",
"path": "/v2/issue",
"queries": {
"issueTypeIds": "10005",
"projectKey": "IP"
}
}
Compose_-Resolved-_Current_Item Compose Condition_-_Status-False "@items('For Each - SHA')"
HTTP_-_Get_all_Active_JIRA_SHA_Incidents Http Compose_-Resolved-_Current_Item
{
"headers": {
"Authorization": "Basic ******"
},
"method": "GET",
"uri": "https://contoso.atlassian.net/rest/api/3/search?jql=Status!=Completed%20and%20cf[10041]~\"Azure\"&fields=key,summary,status,resolution,customfield_10041,description"
}
Parse_JSON_-HTTP-_Get_all_Active_JIRA_SHA_Incidents ParseJson HTTP_-_Get_all_Active_JIRA_SHA_Incidents
{
"content": "@body('HTTP_-_Get_all_Active_JIRA_SHA_Incidents')",
"schema": {
"properties": {
"expand": "@{type=string}",
"issues": "@{items=; type=array}",
"maxResults": "@{type=integer}",
"startAt": "@{type=integer}",
"total": "@{type=integer}"
},
"type": "object"
}
}
For_Each_-_JIRA_SHA_Incident Foreach Parse_JSON_-HTTP-_Get_all_Active_JIRA_SHA_Incidents null
Compose_-_Current_JIRA_SHA_Incident Compose For_Each_-_JIRA_SHA_Incident "@items('For_Each_-_JIRA_SHA_Incident')"
Compose_-_TICKET_ID_Number Compose Compose_-_Current_JIRA_SHA_Incident "@items('For Each - SHA')?['TICKET_ID_Number']"
Compose_-_JIRA_Incident_Id Compose Compose_-_TICKET_ID_Number "@items('For_Each_-_JIRA_SHA_Incident')['id']"
Condition If Compose_-_JIRA_Incident_Id null
HTTP_-_Close_JIRA_SHA_Incident Http Condition
{
"body": {
"transition": {
"id": "111"
},
"update": {
"comment": ""
}
},
"headers": {
"Authorization": "Basic ******"
},
"method": "POST",
"uri": "https://contoso.atlassian.net/rest/api/3/issue/@{outputs('Compose_-_JIRA_Incident_Id')}/transitions"
}

Logic App Connections

This section shows an overview of Logic App Workflow connections.

Connections

ConnectionName ConnectionId ConnectionProperties
azuremonitorlogs /subscriptions/3c20ccf5-16da-469c-8b3b-219de5e4a054/resourceGroups/jiraintegration-demo-rg/providers/Microsoft.Web/connections/azuremonitorlogs null
conversionservice /subscriptions/3c20ccf5-16da-469c-8b3b-219de5e4a054/resourceGroups/jiraintegration-demo-rg/providers/Microsoft.Web/connections/conversionservice null
jira-3 /subscriptions/3c20ccf5-16da-469c-8b3b-219de5e4a054/resourceGroups/jiraintegration-demo-rg/providers/Microsoft.Web/connections/jira-3 null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment