msgraph-sdk-powershell icon indicating copy to clipboard operation
msgraph-sdk-powershell copied to clipboard

New-MgApplicationOwnerByRef not functional in PowerShell Core

Open TahaBenseddik opened this issue 3 years ago • 0 comments

While writing/testing an Powershell script to run through a pipeline powershell task I noticed that New-MgApplicationOwnerByRef doesn't work with the specified parameters. It does however work with version 1.10.0 of the Microsoft.Graph module, but not with 1.11.0

$params = @{
    "@odata.id" = "https://graph.microsoft.com/v1.0/directoryObjects/$ownerObjectId"
}

New-MgApplicationOwnerByRef -ApplicationId $appobjectId -BodyParameter $params

...throws: A parameter cannot be found that matches parameter name 'BodyParameter'

when I run the get-help New-MgApplicationOwnerByRef

output is:

SYNTAX New-MgApplicationOwnerByRef -ApplicationId <String> [-Break] [-HttpPipelineAppend <SendAsyncStep[]>] [-HttpPipelinePrepend <SendAsyncStep[]>] [-PassThru] [-Proxy <Uri>] [-ProxyCredential <PSCredential>] [-ProxyUseDefaultCredentials] [-WhatIf] [-Confirm] [<CommonParameters>]

New-MgApplicationOwnerByRef -InputObject <IApplicationsIdentity> [-Break] [-HttpPipelineAppend <SendAsyncStep[]>]
[-HttpPipelinePrepend <SendAsyncStep[]>] [-PassThru] [-Proxy <Uri>] [-ProxyCredential <PSCredential>]
[-ProxyUseDefaultCredentials] [-WhatIf] [-Confirm] [<CommonParameters>]

As you can see the 'BodyParameter' is missing here....

According to the Microsoft Documentation this parameter should be usable with this command:

https://docs.microsoft.com/en-us/powershell/module/microsoft.graph.applications/new-mgapplicationownerbyref?view=graph-powershell-1.0

TahaBenseddik avatar Aug 11 '22 13:08 TahaBenseddik