如何使用ARM模板将Azure活动日志连接到Log Analytics工作区?我可以通过门户网站连接它:
或使用powershell。
但是我进行了广泛搜索,找不到关于如何使用ARM模板执行此操作的文档(或当前是否可行)。
我也尝试过在azure资源浏览器中创建连接并查看资源结构(并通过在powershell中获取资源),但是在建立连接之前和之后json都没有区别
更新:
我尝试了基于this documentation的手臂模板部署,我将其应用为:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"resources": [
{
"name": "my-loganalytics-workspace-name/AzureActivityLog",
"type": "Microsoft.OperationalInsights/workspaces/dataSources",
"apiVersion": "2015-11-01-preview",
"tags": {},
"properties": {},
"kind": "AzureActivityLog"
}
]
}
但是部署没有完成(已经运行了30分钟)并且存在模糊的错误:
{
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxxxxxxx/resourceGroups/my-resource-group/providers/Microsoft.Resources/deployments/template/operations/A886A53AFF9B2E6C",
"operationId": "A886A53AFF9B2E6C",
"properties": {
"provisioningOperation": "Create",
"provisioningState": "Running",
"timestamp": "2019-03-25T13:54:32.2320046Z",
"duration": "PT21M58.8224235S",
"trackingId": "47915902-f795-482a-a408-de408cd78a30",
"serviceRequestId": "8c153090-c33d-4819-b9c4-8226df6a861e",
"statusCode": "InternalServerError",
"statusMessage": {
"Message": "An error has occurred."
},
"targetResource": {
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxxxxxxx/resourceGroups/my-resource-group/providers/Microsoft.OperationalInsights/workspaces/my-log-analytics-workspace/dataSources/AzureActivityLog",
"resourceType": "Microsoft.OperationalInsights/workspaces/dataSources",
"resourceName": "my-log-analytics-workspace/AzureActivityLog"
}
}
}
答案 0 :(得分:1)
是的,可以使用门户或PowerShell,如此处所述-> Connecting Azure Activity Log to Log Analytics instance using PowerShell
我已经使用门户网站或PowerShell创建了它,并且可以使用PowerShell获取这些详细信息,如以下屏幕截图所示,其中ResourceId参数显示了资源类型'Microsoft.OperationalInsights / workspaces / dataSources'。
所以很可能也可以通过ARM模板方式实现,因为我看到了资源类型'Microsoft.OperationalInsights / workspaces / dataSources'的ARM模板引用,如下所示-> https://docs.microsoft.com/en-us/azure/templates/microsoft.operationalinsights/2015-11-01-preview/workspaces/datasources
希望这会有所帮助!!干杯!
答案 1 :(得分:0)