在关于这个的例子中https://learn.microsoft.com/en-us/powershell/microsoftgraph/find-mg-graph-command?view=graph-powershell-1.0 https://learn.microsoft.com/en-us/powershell/microsoftgraph/find-mg-graph-command?view=graph-powershell-1.0,我看到一个叫“变体”的东西,但是我搜索的时候没有找到“变体”的任何解释。
具体来说,我正在尝试与我们的 Azure 团队合作,为电子邮件“markRead”功能设置适当的权限:
$graphApiPostUrl = "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages/markRead"
Find-MgGraphCommand -Uri $graphApiPostUrl | Format-Table -AutoSize
我请求了 ServiceMessageViewpoint.Write 权限,他们说他们已经给了我,但当我尝试时,我仍然收到“401 未经授权”的消息。我想知道我是否也需要请求变体? [我可以列出/枚举电子邮件。]
我原来的问题在这里:Powershell - 如何设置 GraphAPI 的令牌以将电子邮件标记为已读? https://stackoverflow.com/questions/73898993/powershell-how-to-set-token-for-graphapi-to-mark-emails-as-read
变体与 Azure 权限没有任何关系。在这种情况下,它们是 Powershell 参数集的不同词。
get-help Find-MgGraphCommand -Full
OUTPUTS
Microsoft.Graph.PowerShell.Authentication.Models.IGraphCommand with the following properties:
1. Command: Name of command.
2. Module: Module in which a command is defined.
3. Method: The HTTP method a command makes.
4. Uri: The Microsoft Graph API URI a command calls.
5. OutputType: The return type of a command.
6. Permissions: Permissions needed to use a command. This field can be empty if the permissions are not yet
available in Graph Explorer.
7. Variants: The parameter sets of a command.
https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_parameter_sets?view=powershell-7.2 https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_parameter_sets?view=powershell-7.2
PowerShell 使用参数集使您能够编写可以针对不同场景执行不同操作的单个函数。参数集使您能够向用户公开不同的参数。并且,根据用户指定的参数返回不同的信息。您一次只能使用一组参数。
您正确使用了该命令,但对图形 API 的调用存在问题。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)