简体   繁体   中英

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM