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

Module suddenly stop working #20

Closed
Nikolara97 opened this issue Apr 30, 2024 · 13 comments
Closed

Module suddenly stop working #20

Nikolara97 opened this issue Apr 30, 2024 · 13 comments

Comments

@Nikolara97
Copy link

Hi Andrew,

Module was working without issues, but suddenly from yesterday each time I run it I am getting following issue. Any idea?

Loading all objects. This can take a while on large tenants
Invoke-MgGraphRequest : The pipeline has been stopped.
At C:\Program Files\WindowsPowerShell\Scripts\get-windowsautopilotinfocommunity.ps1:1959 char:26

  • ... response = (Invoke-MgGraphRequest -Uri $url -Method Get -OutputType P ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [Invoke-MgGraphRequest], PipelineStoppedException
    • FullyQualifiedErrorId : Microsoft.Graph.PowerShell.Authentication.Cmdlets.InvokeMgGraphRequest

Something went wrong. Error: Method not found: 'Void Microsoft.Graph.Authentication.AzureIdentityAccessTokenProvider..ctor(Azure.Core.TokenCredential, System.String[], Microsoft.Kiota.Authentication.Azure.ObservabilityOptions, System.String[])'.
Stop-Transcript : An error occurred stopping transcription: The host is not currently transcribing.
At D:\AutoPilot3.ps1:128 char:5

  • Stop-Transcript
    
  • ~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [Stop-Transcript], PSInvalidOperationException
    • FullyQualifiedErrorId : InvalidOperation,Microsoft.PowerShell.Commands.StopTranscriptCommand
@andrew-s-taylor
Copy link
Owner

Hi,
Can you confirm which version of the PowerShell SDK you have installed?
The module microsoft.graph.authentication is the best one to check

@Nikolara97
Copy link
Author

Hey @andrew-s-taylor sorry for late response I was on vacation... After rolling back to older version of Graph.Authentification module everything work's again...

@secotton
Copy link

secotton commented May 9, 2024

I'm having the same issue - been trying to get it working, but no avail. Going to a different version of Graph.Authentication isn't quite helping, nor is using the updated one from Microsoft they released today (2.19.0). What I've observed, is if I open a new PowerShell window, and re-run the get-windowsautopilotinfocommunity.ps1 script, it appears to function fine. However - the kicker is I can't for the life of me get it to run within the context of a script. It was all working great before Microsoft updated their Graph.Authentication module.

There's another post similar to this: microsoftgraph/msgraph-sdk-powershell#2715

@andrew-s-taylor
Copy link
Owner

Hi, is it any particular command in the module, or all of them?

@secotton
Copy link

So I'm running this during the OOBE portion of a Windows setup (Shift + F10). I've got a PowerShell script that's hosted online that:

  • sets the execution policy to bypassed
  • installs NuGet
  • Installs Microsoft.Graph (I've installed 2.17 since 2.18 seems to have an issue introduced)
  • Installs / Imports the Az.KeyVault, Windows AutoPilot Info Community, and WindowsAutopilotIntuneCommunity module
  • Connects to Azure AD (connect-azaccount)
  • Gets the Autopilot parameters from a KeyVault
  • Adds to the path: $env:Path += ";C:\Program Files\WindowsPowerShell\Scripts"
  • Kicks off the following: get-windowsautopilotinfocommunity.ps1 -Online -AppId $AutopilotParams.AppId -AppSecret $AutopilotParams.secret -Tenantid $AutopilotParams.tenant -grouptag $GRPTAG

This is where the same error comes up.

Interestingly, if I run through this all manually, I get the same error. However, if I run Powershell from within a PowerShell window and re-run the same command ( get-windowsautopilotinfocommunity.ps1 -Online -AppId $AutopilotParams.AppId -AppSecret $AutopilotParams.secret -Tenantid $AutopilotParams.tenant -grouptag $GRPTAG ), it works as intended.

I tried also just specifying the -online parameter and used my own credentials, and same result.

Still working through the issues we saw came up last week around the time Microsoft updated the Graph module from 2.17 to 2.18. I was hoping 2.19 would have fixed it, but it seems it didn't as of yet.

@andrew-s-taylor
Copy link
Owner

Ah, it's probably the AZ and Graph modules causing issues again, it happened with one of the V1 versions as well which broke pagination.

As a workaround, try adding "-newdevice" to the command, that skips retreiving the device list so won't worry about pagination issues

@secotton
Copy link

secotton commented May 14, 2024

Invoke-MgGraphRequest : The pipeline has been stopped.
At C:\Program Files\WindowsPowerShell\Scripts\get-windowsautopilotinfocommunity.ps1:639 char:17

  • ... Invoke-MgGraphRequest -Uri $uri -Method Post -Body $json ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [Invoke-MgGraphRequest], PipelineStoppedException
    • FullyQualifiedErrorId : Microsoft.Graph.PowerShell.Authentication.Cmdlets.InvokeMgGraphRequest

Add-AutopilotImportedDevice : System.MissingMethodException: Method not found: 'Void
Microsoft.Graph.Authentication.AzureIdentityAccessTokenProvider..ctor(Azure.Core.TokenCredential, System.String[],
Microsoft.Kiota.Authentication.Azure.ObservabilityOptions, System.String[])'.
at Microsoft.Graph.PowerShell.Authentication.Core.Utilities.AuthenticationHelpers.d_
_10.MoveNext()
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)
at Microsoft.Graph.PowerShell.Authentication.Core.Utilities.AuthenticationHelpers.GetAuthenticationProviderAsync(IAu
thContext authContext)
at Microsoft.Graph.PowerShell.Authentication.Helpers.HttpHelpers.GetGraphHttpClient()
at Microsoft.Graph.PowerShell.Authentication.Cmdlets.InvokeMgGraphRequest.d__109.MoveNext()
At C:\Program Files\WindowsPowerShell\Scripts\get-windowsautopilotinfocommunity.ps1:2119 char:34

  • ... imported += Add-AutopilotImportedDevice -serialNumber $_.'Device Seri ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
    • FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Add-AutopilotImportedDevice

@secotton
Copy link

Before issuing the connect-azaccount, I had to issue: Update-AzConfig -EnableLoginByWam $false

Seems to be working again now as intended.

@andrew-s-taylor
Copy link
Owner

Thank you for letting me know. I'll add it as a comment in the next release :)

@jmullenhub
Copy link

Hey Andrew, I am having a similar issue, when trying to delete the device from Intune, I am getting an error. I have tried sdk 2.17.0, 2.18.0, and 2.19.0 and am getting the same error on each. I've been using this script for a long time and have never encountered this issue before. Here is the error I am getting.

Delete Intune Device
Do you want to DELETE ~~~~~ from the Intune?
[Y] Yes [N] No [?] Help (default is "N"): y
Invoke-MgGraphRequest : DELETE https://graph.microsoft.com/beta/deviceManagement/managedDevices/
HTTP/1.1 400 Bad Request
Transfer-Encoding: chunked
Vary: Accept-Encoding
Strict-Transport-Security: max-age=31536000
request-id: ede0f980-1af7-411c-8905-7e0acffec8d4
client-request-id: eb1c7800-a9e5-4a34-b048-49e60ea06443
x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"Central
US","Slice":"E","Ring":"4","ScaleUnit":"003","RoleInstance":"DS1PEPF0001A35C"}}
Date: Wed, 05 Jun 2024 16:52:57 GMT
Content-Encoding: gzip
Content-Type: application/json
{"error":{"code":"No method match route template","message":"No OData route exists that match template
~/singleton/navigation with http verb DELETE for request /DeviceFE/StatelessDeviceFEService/deviceManagement/managedDev
ices.","innerError":{"date":"2024-06-05T16:52:57","request-id":"ede0f980-1af7-411c-8905-7e0acffec8d4","client-request-i
d":"eb1c7800-a9e5-4a34-b048-49e60ea06443"}}}
At C:\Program Files\WindowsPowerShell\Scripts\AutopilotNuke.ps1:394 char:29

  • ... $response = Invoke-MgGraphRequest -Uri $url -Method Delete -OutputTyp ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (Method: DELETE,...nt-Length: 0
      }:HttpRequestMessage) [Invoke-MgGraphRequest], HttpResponseException
    • FullyQualifiedErrorId : InvokeGraphHttpResponseException,Microsoft.Graph.PowerShell.Authentication.Cmdlets.Invok
      eMgGraphRequest

@andrew-s-taylor
Copy link
Owner

Hi, Is that the module, or the nuke script?
Looking at the error, it hasn't been passed the device ID

@jmullenhub
Copy link

jmullenhub commented Jun 6, 2024

This is from running the nuke script, all other pieces of the script are working except the delete intune device portion. I removed the name of the device for anonymity purposes.

@andrew-s-taylor
Copy link
Owner

Does it list Intune devices before that? It's not populating any device names in your yes/no message

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

4 participants