Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将PowerShell命令转换为C#_C#_Azure_Powershell_Azure Functions - Fatal编程技术网

将PowerShell命令转换为C#

将PowerShell命令转换为C#,c#,azure,powershell,azure-functions,C#,Azure,Powershell,Azure Functions,我正在使用azure函数和单行powershell代码来触发azure Runbook Invoke-RestMethod -Method Post -Uri 'https://s16events.azure-automation.net/webhooks?token=' 我想用C#language Azure函数做同样的事情这只是一个简单的post请求,有很多例子,你可以看看这个 一个简单的代码示例: using System.Net.Http; HttpClient client = n

我正在使用azure函数和单行powershell代码来触发azure Runbook

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

我想用C#language Azure函数做同样的事情

这只是一个简单的post请求,有很多例子,你可以看看这个

一个简单的代码示例:

using System.Net.Http;

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

您可以随意修改此代码以满足您的需要。

为什么创建函数的唯一目的是触发runbook?这就像点燃一根火柴点燃一根火柴点燃一根动力棒在C#中有几种方法可以做到这一点。这只是一个邮寄电话。Azure与否与您基本上要做的事情无关这是我将此代码应用于Azure函数时遇到的错误,该函数缺少名为“req”的触发器参数。请让我知道如何在Azure中使用此参数Function@Joshua,请与我共享您编写的代码(并隐藏凭据等个人信息)。