0

I'm using an azure function with this single line powershell code to trigger Azure Runbook

Invoke-RestMethod -Method Post -Uri 'https://s16events.azure-automation.net/webhooks?token='

I want to do the same using C# language Azure Function

Rufus L
  • 36,127
  • 5
  • 30
  • 43
Joshua
  • 17
  • 1
  • 2
    Why would you create a function with the sole purpose of triggering a runbook? That is like lighting a match to light a match to light a stick of dynamite – Axel Andersen Jun 18 '19 at 19:36
  • There are a few ways of doing this in C#. This is just a POST call. Azure or no Azure wouldnt matter with what you are basically trying to do – ArcSet Jun 18 '19 at 19:41

1 Answers1

1

It's just a simple post request, there're a lot of examples, you can take a look at this one.

A simple code example:

using System.Net.Http;

HttpClient client = new HttpClient();
client.PostAsync("your_url", null).GetAwaiter().GetResult();

And just feel free to modify this code to meet your need.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Ivan Glasenberg
  • 29,865
  • 2
  • 44
  • 60