Update-MgOrganizationSettingPersonInsight input parameter error (but API works)

Raffaele Sgherri 1 Reputation point Microsoft Employee
2022-09-22T07:31:33.04+00:00

If I make the call:

Update-MgOrganizationSettingPersonInsight -OrganizationId ####### -IsEnabledInOrganization $false

I get the error

"Update-MgOrganizationSettingPersonInsight: A positional parameter cannot be found that accepts argument 'False'."

while if I use the BodyParameter option:

$params = @{ isEnabledInOrganization = $false }
Update-MgOrganizationSettingPersonInsight -OrganizationId ####### -BodyParameter $params

it works as expected.
Is that a bug?

I noted as well that to make it work I need two UserScopes as below:

Connect-MgGraph -Scopes "User.ReadWrite","Directory.ReadWrite.All"

but only the first is documented.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,447 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. 2022-09-28T10:54:40.43+00:00

    Hi @Raffaele Sgherri ,

    As it is documented code for the PowerShell it is working as expected i tried it from my side:

    245513-image.png

    The code provided in the document:

    Import-Module Microsoft.Graph.Identity.DirectoryManagement  
      
    $params = @{  
    	IsEnabledInOrganization = $true  
    	DisabledForGroup = "edbfe4fb-ec70-4300-928f-dbb2ae86c981"  
    }  
      
    Update-MgOrganizationSettingPersonInsight -OrganizationId $organizationId -BodyParameter $params  
    

    I was able to run the code snippet with only User.Readwrite permission it didn't ask me for the "Directory.ReadWrite.All" permission.

    245460-image.png

    ----------

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    0 comments No comments