繁体   English   中英

使用 Rest 在 Azure 逻辑应用程序中启用 Log Analytics 的工作流部署 API

[英]Workflow deployment with enabling Log Analytics in Azure Logic App using Rest API

我正在尝试使用工作流 Rest API( https://learn.microsoft.com/en-us/rest/api/logic/workflows )在 Azure 中部署工作流。 我想在 Logic App 中部署此工作流时启用 Log Analytics Workspace。 在创建逻辑应用程序时,这在门户中是直截了当的。 但是在创建工作流定义(JSON 文件)时,我没有找到任何文档或信息来传递日志分析工作区。 请让我知道,如果有办法通过它

在上面的评论中,您提到“如果可以在 ARM 模板中使用,那么我可以接受,我将使用 ARM 模板部署 API 来部署它。

这是一个示例,请随时对其进行修改以使其适合您的需要:

{
    "$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
                        }
                    }
                ]
            }
        }
    ]
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM