azureazure-security

What are "variants" in Azure permissions


In the examples on this https://learn.microsoft.com/en-us/powershell/microsoftgraph/find-mg-graph-command?view=graph-powershell-1.0, I see something called "variants", but I haven't found any explanation of "variants" when I search.

Specifically, I'm trying to work with our Azure team to set the proper permission for the email "markRead" function:

$graphApiPostUrl = "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages/markRead"
Find-MgGraphCommand -Uri $graphApiPostUrl | Format-Table -AutoSize

enter image description here

I requested ServiceMessageViewpoint.Write permisison, and they said they gave it to me, but I'm still gettting an "401 unauthorized" when I try it. I'm wondering if I need to request the variants as well? [I am able to list/enumerate the emails.]

My original question was here: Powershell - How to set token for GraphAPI to mark emails as read?


Solution

  • Variants don't have anything to do with Azure Permissions. In this case, they are a different word for Powershell parameter sets.

    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 uses parameter sets to enable you to write a single function that can do different actions for different scenarios. Parameter sets enable you to expose different parameters to the user. And, to return different information based on the parameters specified by the user. You can only use one parameter set at a time.

    You are using the command correctly, there is rather an issue the call to graph API.