Get-MgApplication 未被识别为 cmdlet 的名称 - Power Shell

Get-MgApplication is not recognized as the name of a cmdlet - Power Shell

我正在尝试 运行 Microsoft 提供的 Contoso 货币化代码示例 Web 应用程序作为从付费加载项迁移到 SaaS 产品的起点。我被困在最后,我打算更新 Azure Active Directory 应用程序。我得到这个错误

Get-MgApplication : The term 'Get-MgApplication' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. + $webApp = Get-MgApplication -top 400|Where-Object {$_.DisplayName -eq ...+ CategoryInfo : ObjectNotFound: (Get-MgApplication:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException

这是引用 'Get-MgApplication' 的代码。

      $webApp = Get-MgApplication -top 400|Where-Object {$_.DisplayName -eq $webAppDisplayName}
      $webAppSiteName = $armConfigJson.parameters.webAppSiteName.value
      $redirectUris = "https://$webAppSiteName.azurewebsites.net/signin-oidc","https://$webAppSiteName.azurewebsites.net/" 
      Update-MgApplication -ApplicationId $webApp.Id -WebRedirectUris $redirectUris

我在网上查了下这个模块是否可以导入加载,没有成功。我还检查了使用命令 get-Module 检查是否在 power shell 模块文件夹中并且可能拼写错误但它也不在那里。任何帮助将不胜感激。

您需要安装 Microsoft.Graph.Beta cmdlet - https://github.com/microsoftgraph/msgraph-sdk-powershell/tree/master