0

我有一个典型的场景,通过 azure 函数执行 powershell 脚本并从 office 365 API 获取数据。我对云技术非常陌生,希望得到任何可以指导我进一步进步的帮助。

4

1 回答 1

0

您最好的选择是使用 powershell 与 O365 的 REST api 进行交互。

这是有关 powershell 的Invoke-RestMethodO365 的 API 的文档

Azure 函数可以用 powershell 编写,因此如果需要,可以将其完全编写为函数。

我希望这能让你走上正轨!

编辑:

在 C# 中,您将使用 Json 将 HTTP 发布到 Azure 函数 URL(这将触发该函数),您的 Azure 函数将如下所示:

$requestBody = Get-Content $Env:req -Raw | ConvertFrom-Json #This pulls in your json from your request and converts it to a PSCustomObject

if ($requestbody.name -eq "run") #Which can be refrenced by key/value
{

    $something = Get-MsolUser #Whatever paramters here
    #Put whatever you want to do with the info down here

}
于 2016-06-03T17:26:35.420 回答