【问题标题】:What are "variants" in Azure permissionsAzure 权限中的“变体”是什么
【发布时间】:2022-10-13 20:41:28
【问题描述】:

在这个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 - How to set token for GraphAPI to mark emails as read?

【问题讨论】:

  • 您是否尝试对返回的 URL 使用 Invoke-AzRestMethod

标签: azure azure-security


【解决方案1】:

变体与 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

PowerShell 使用参数集使您能够编写一个函数,该函数可以针对不同的场景执行不同的操作。参数集使您能够向用户公开不同的参数。并且,根据用户指定的参数返回不同的信息。您一次只能使用一个参数集。

您正确使用了该命令,对图形 API 的调用存在相当大的问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-12
    • 1970-01-01
    • 1970-01-01
    • 2019-12-14
    • 1970-01-01
    相关资源
    最近更新 更多