【问题标题】:How to consume Azure Alert payload to HTTP trigger azure function如何使用 Azure 警报负载到 HTTP 触发 azure 函数
【发布时间】:2021-09-06 20:49:42
【问题描述】:

我正在尝试使用 Azure 警报在调用 Azure 函数时发送的有效负载。

def main(req: func.HttpRequest) -> func.HttpResponse:
    logging.info('Python HTTP trigger function processed a request.')
    req_body = req.get_json()
    print(req_body)

但在 req_body 变量中没有得到任何东西。 任何人都知道如何在 python azure 函数中使用它。

【问题讨论】:

    标签: python azure azure-functions azure-alerts


    【解决方案1】:

    如果要使用azure alert触发Azure Function,请参考以下步骤

    1. 创建 Azure 函数。我的代码如下
    def main(req: func.HttpRequest) -> func.HttpResponse:
        logging.info('Python HTTP trigger function processed a request.')
    
      
        req_body = req.get_json()
        logging.info(req_body)
        return func.HttpResponse(
                 "This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response.",
                 status_code=200
        )
    
    1. 创建警报

      一个。定义条件

      b.定义操作组

    2. 测试

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-19
    • 1970-01-01
    • 2021-01-25
    • 1970-01-01
    • 1970-01-01
    • 2022-08-19
    相关资源
    最近更新 更多