添加SQL防火墙规则时的Azure警报

问题描述 投票:1回答:1

有没有办法在firewall rule is added to an Azure SQL database时获得警报?我检查了监控刀片,但没有看到针对此的度量标准或日志事件。

azure azure-sql-database
1个回答
1
投票

您可以使用逻辑应用程序来实现:

  1. 使用“收到HTTP请求时”模板创建新的逻辑应用程序。使用以下JSON作为样本有效负载。那么你需要添加一个条件和一个动作(电子邮件?)。在电子邮件正文中,您可以发送更多详细信息,如来电者电子邮件,来电显示等。

条件应为Status = Activated,OperationName =“Microsoft.Sql / servers / firewallRules / write”。 enter image description here 2.在Monitor中创建一个新警报。资源将是您的SQL Server,信号将是“所有管理操作”。创建新的操作组并设置webhook操作。在上一步中使用逻辑应用程序webhook url generate。

{
    "headers": {
        "Connection": "Keep-Alive",
        "Expect": "100-continue",
        "Host": "abc.logic.azure.com",
        "User-Agent": "IcMBroadcaster/1.0",
        "X-CorrelationContext": "abc",
        "Content-Length": "1350",
        "Content-Type": "application/json; charset=utf-8"
    },
    "body": {
        "schemaId": "Microsoft.Insights/activityLogs",
        "data": {
            "status": "Activated",
            "context": {
                "activityLog": {
                    "channels": "Operation",
                    "eventSource": "Administrative",
                    "eventTimestamp": "2019-03-09T10:00:36.549+00:00",
                    "eventDataId": "eventid",
                    "level": "Informational",
                    "operationName": "Microsoft.Sql/servers/firewallRules/write",
                    "properties": {
                        "originalEventTimestamp": "03/09/2019 10:00:17",
                        "correlationId": "correlationId",
                        "eventId": "eventId",
                        "eventName": "OverwriteFirewallRules",
                        "operationName": "Microsoft.Sql/servers/firewallRules/write",
                        "status": "Succeeded",
                        "description_scrubbed": "description",
                        "caller": "[email protected]",
                        "callerCredentialType": "LiveId",
                        "eventChannel": "OperationLogStore",
                        "ipAddress": "useripaddress",
                        "eventSource": "SQL Databases Event Supplier"
                    },
                    "resourceId": "resourceId",
                    "resourceGroupName": "groupname",
                    "resourceProviderName": "MICROSOFT.SQL",
                    "status": "Succeeded",
                    "subscriptionId": "subscriptionId",
                    "submissionTimestamp": "2019-03-09T10:00:36.549+00:00",
                    "resourceType": "microsoft.sql/servers"
                }
            },
            "properties": {}
        }
    }
}
© www.soinside.com 2019 - 2024. All rights reserved.