简体   繁体   English

将 PowerShell 命令转换为 C#

[英]Convert PowerShell command to C#

I'm using an azure function with this single line powershell code to trigger Azure Runbook我正在使用带有此单行 powershell 代码的 azure 函数来触发 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我想使用 C# 语言 Azure 函数做同样的事情

It's just a simple post request, there're a lot of examples, you can take a look at this one .这只是一个简单的POST请求,是有很多的例子,你可以看看这一个

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.并且可以随意修改此代码以满足您的需要。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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