Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mg graph 2.0.0 update causing issues in azure devops release pipelines. Invoke-MgGraphRequest : Method not found #2161

Closed
shahidsayyed892 opened this issue Jul 14, 2023 · 3 comments

Comments

@shahidsayyed892
Copy link

$context = Get-AzContext
$graphToken = [Microsoft.Azure.Commands.Common.Authentication.AzureSession]::Instance.AuthenticationFactory.Authenticate($context.Account, $context.Environment, $context.Tenant.Id.ToString(), $null, [Microsoft.Azure.Commands.Common.Authentication.ShowDialog]::Never, $null, "https://graph.microsoft.com").AccessToken
$secureAccessToken = $graphToken | ConvertTo-SecureString -AsPlainText -Force
Connect-MgGraph -AccessToken $secureAccessToken
Get-InstalledModule Microsoft.Graph

$UserReadAllId = Find-MgGraphPermission User.Read.All -ExactMatch -PermissionType Application | Select-Object -ExpandProperty Id
write-host $UserReadAllId
Invoke-MgGraphRequest : Method not found: 'Void Microsoft.Graph.Authentication.AzureIdentityAccessTokenProvider..ctor(Azure.Core.TokenCredential, System.String[], Microsoft.Kiota.Authentication.Azure.ObservabilityOptions, System.String[])'.
At C:\Program Files\WindowsPowerShell\Modules\Microsoft.Graph.Authentication\2.0.0\custom\common\Permissions.ps1:37 char:27
+ ... estResult = Invoke-MgGraphRequest -method GET -OutputType PSObject $_ ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Invoke-MgGraphRequest], MissingMethodException
    + FullyQualifiedErrorId : NotSpecified,Microsoft.Graph.PowerShell.Authentication.Cmdlets.InvokeMgGraphRequest
 
Script stack trace:
at Permissions_GetPermissionsData, C:\Program Files\WindowsPowerShell\Modules\Microsoft.Graph.Authentication\2.0.0\custom\common\Permissions.ps1: line 37
at Find-MgGraphPermission<Begin>, C:\Program Files\WindowsPowerShell\Modules\Microsoft.Graph.Authentication\2.0.0\custom\Find-MgGraphPermission.ps1: line 202

Facing this issue from 12 July 23.
Seems like microsoft has upgraded mggraph to 2.0.0 in devops pipeline, which earlier was 1.28.0

My use case involves calling below commands in azure devops pipeline to automate tasks:

  • Find-MgGraphPermission
  • Get-MgServicePrincipal
  • Get-MgServicePrincipalAppRoleAssignedTo
  • New-MgServicePrincipalAppRoleAssignment
@andikrueger
Copy link

Please have a look at this issue and try to update to V2.1.0

#2148

@peombwa
Copy link
Member

peombwa commented Jul 14, 2023

Please have a look at this issue and try to update to V2.1.0

#2148

Please see the resolution above.

Closing as duplicate of #2148 (comment).

@peombwa peombwa closed this as completed Jul 14, 2023
@ghost ghost removed the ToTriage label Jul 14, 2023
@shahidsayyed892
Copy link
Author

Thanks @andikrueger

Install-Module Microsoft.Graph -RequiredVersion 2.1.0 -Force -AllowClobber

updating the mg-graph to v2.1.0 has resolved this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants