0

I am trying to deploy workflows in Azure using workflows Rest API's(https://learn.microsoft.com/en-us/rest/api/logic/workflows ). I want to enable Log Analytics Workspace while deploying this workflow in Logic App. This is straight forward in portal while creating logic app. But I didn't find any document or information to pass log analytics workspace while creating workflow definition(JSON File). Please let me know, if there is a way to pass it

2
  • 1
    It s possible using ARM template if you're interested in Commented Sep 17, 2021 at 1:40
  • If it's possible in ARM Template, then I am fine with it and I will use ARM Template deployment API's to deploy it. Please let me know, some sample template to achieve it. Thanks in advance.. Commented Sep 17, 2021 at 5:06

1 Answer 1

-1

In a comment above you mentioned "If it's possible in ARM Template, then I am fine with it and I will use ARM Template deployment API's to deploy it."

Here's an example, feel free to amend it so that it suits your needs:

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "logicapp-name": {
            "type": "string",
            "defaultValue": "testLogicApp",
            "metadata": {
                "description": "Name of the Logic App"
            }
        },
        "loganalytics-workspace-resourceid": {
            "type": "string",
            "defaultValue": "/subscriptions/11111111-2222-3333-4444-555555555555/resourcegroups/testResourceGroup/providers/microsoft.operationalinsights/workspaces/testLogAnalyticsWorkspace",
            "metadata": {
                "description": "Resource ID of the Log Analytics workspace"
            }
        }
    },
    "variables": {
        "logAnalyticsSettingName": "testDiagnosticSettingName"
    },
    "resources": [
        {
            "type": "Microsoft.Logic/workflows/providers/diagnosticSettings",
            "name": "[concat(parameters('logicapp-name'),'/Microsoft.Insights/', variables('logAnalyticsSettingName'))]",
            "apiVersion": "2017-05-01-preview",
            "properties": {
                "workspaceId": "[parameters('loganalytics-workspace-resourceid')]",
                "logs": [
                    {
                        "category": "WorkflowRuntime",
                        "enabled": true,
                        "retentionPolicy": {
                            "days": 0,
                            "enabled": false
                        }
                    }
                ],
                "metrics": [
                    {
                        "timeGrain": "PT1M",
                        "enabled": true,
                        "retentionPolicy": {
                            "enabled": false,
                            "days": 0
                        }
                    }
                ]
            }
        }
    ]
}
Sign up to request clarification or add additional context in comments.

2 Comments

with logic app standard we deploy logic app workflow seperatly, the answer you shown will enable the workflow at the time of creation of logic app.
@RakeshSuryawanshi The question wasn't about Standard Logic Apps (and the appropriate tag wasn't used) - the answer perfectly works for Consumption Logic Apps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.