Joshua
Joshua

Reputation: 17

Convert PowerShell command to C#

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

Upvotes: 0

Views: 716

Answers (1)

Ivan Glasenberg
Ivan Glasenberg

Reputation: 30035

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.

Upvotes: 1

Related Questions