How to launch Azure Automation Runbooks using a webhook request

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 ม.ค. 2025

ความคิดเห็น • 5

  • @MuhammedSavadkv
    @MuhammedSavadkv 8 หลายเดือนก่อน

    Thank you for the explanation. Anyone did the above things in python. Create an runbook in python and take two parameters as input. create another python script to POST HTTP the above webhook url and the parameters

    • @devopsinfo391
      @devopsinfo391  7 หลายเดือนก่อน

      Hi thanks for your comments and nice idea to try them on Python as well.
      Basically you can create a webhook ,Trigger the Runbook via Webhook
      make an HTTP POST request to the webhook URL
      You can try something like below
      import requests
      import json
      webhook_url = 'your_webhook_url_here'
      payload = {
      'param1': 'value1',
      'param2': 'value2'
      }
      response = requests.post(webhook_url, data=json.dumps(payload), headers={'Content-Type': 'application/json'})
      if response.status_code == 200:
      print("Runbook triggered successfully!")
      else:
      print(f"Error triggering the Runbook. Status code: {response.status_code}")

  • @SantoshPatil-ld4yg
    @SantoshPatil-ld4yg 5 หลายเดือนก่อน +1

    Hi, Thanks for the video, I have one question regards to azure automation account runbook, I have scenario, were I need to start the runbook job from monitoring alerts. can you help me how can i configure? example if someone delete VM instance from VMSS, the alert should trigger if virtual machine delete.

    • @devopsinfo391
      @devopsinfo391  5 หลายเดือนก่อน +1

      Very Good Question This one you can achieve this via log analytics workspace - th-cam.com/video/OxZGz-jxkv8/w-d-xo.htmlsi=9yVJk6uCqMfFJLb2
      If you want this via automation accounts then you can try something like below
      Create a Runbook - add the necessary code to handle the alert (e.g., stopping a VM).
      Create an Alert Rule - Condition, select the signal type (e.g., Activity Log) and configure the alert logic to trigger when a VM is deleted.
      Under Action group, create or select an action group that includes a webhook pointing to your runbook.

    • @SantoshPatil-ld4yg
      @SantoshPatil-ld4yg 5 หลายเดือนก่อน

      @@devopsinfo391 Thanks for reply, I am working 2nd point with Alert rule, but i failed to grab the exact data(webhook) from alert payload to runbook. basically, I need VMSS instance name and instance computer name also datadisk information if we want to detach and attach to newly created instance