我有 MVC 网站,我在其中从 Webhook Uri 调用了 Runbook,但现在我想将输入参数传递给 Runbook。以下代码是我编写的调用 runbook 并传递参数,但参数在 Webhookdata 中而不是作为输入。
using(var client = new HttpClient()) {
client.BaseAddress = new Uri("https://s2events.azure-automation.net/");
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
// HTTP POST
var parameters = new InputParam() {
subscriptionId = mSubscriptnId,
resourceGrpName = vMachine.ResourceGroupName,
vmssName = vMachine.Name,
vmssInstanceId = vMachine.InstanceId,
action = vmssInstanceAction,
count = "5"
};
HttpResponseMessage response = client.PostAsJsonAsync(mWebhookUri, parameters).Result;
if(response.IsSuccessStatusCode) {
Console.WriteLine(response.Content);
}