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

Issues with Graph Requests #2

Open
rickdm opened this issue Jun 22, 2023 · 8 comments
Open

Issues with Graph Requests #2

rickdm opened this issue Jun 22, 2023 · 8 comments

Comments

@rickdm
Copy link

rickdm commented Jun 22, 2023

Initially there was an error thrown by Install-Modules because the MSGraphRequest module required an additional flag to be passed. Now I am receiving another error related to Graph

WARNING: Graph request failed with status code '400 (BadRequest)'. Error details: AuthenticationError - Error 
authenticating with resource
WARNING: Unhandled error occurred, application will be skipped

My Service Principle has the permissions DeviceManagementApps.ReadWrite.All and DeviceManagementRBAC.ReadWrite.All

@uevinysses
Copy link

I have a similar issue. Initially I had an error thrown by Install-Modules because the MSGraphRequest module thew up this error "This module 'MSGraphRequest' may override the existing commands. If you still want to install this module
'MSGraphRequest', use -AllowClobber parameter." So I added the -AllowClobber to the script.

I'm now getting an issue when the Test-AppList script runs:
"Attempting to find application in Intune
WARNING: Unhandled error occurred, application will be skipped"

Unlike the issue reported by rickdm I'm not getting an authentication error. I'm not sure if the Invoke-MSGraphOperation Command is even running on the build agent and I'm unsure how I can see this in the Pipeline logs or test it. Could this be related to the issue that I had in the Install-Modules script?

@uevinysses
Copy link

I have managed to resolve my issue.

The unhandled error message was caused because we had no Win32 apps registered in Intune which caused the error in the Test-AppList script. When the Graph query pulled back no results (null) the if statement is set to error.

@skyblaster
Copy link

Just in case it's relevant, here's an MSGraph error from my first run.

Starting: Install-Modules
==============================================================================
Task         : PowerShell
Description  : Run a PowerShell script on Linux, macOS, or Windows
Version      : 2.220.0
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/powershell
==============================================================================
Generating script.
Formatted command: . 'C:\ADOAgent\_work\1\s\Scripts\Install-Modules.ps1'
========================== Starting Command Output ===========================
"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'C:\ADOAgent\_work\_temp\c11b2b7e-ee91-489f-8b38-56e161b1789b.ps1'"
Attempting to install the following module: Evergreen
Attempting to install the following module: IntuneWin32App
Attempting to install the following module: MSGraphRequest
PackageManagement\Install-Package : The following commands are already available on this system:'Test-AccessToken'. 
This module 'MSGraphRequest' may override the existing commands. If you still want to install this module 
'MSGraphRequest', use -AllowClobber parameter.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1809 char:21
+ ...          $null = PackageManagement\Install-Package @PSBoundParameters
+                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package],  
   Exception
    + FullyQualifiedErrorId : CommandAlreadyAvailable,Validate-ModuleCommandAlreadyAvailable,Microsoft.PowerShell.Pack 
   ageManagement.Cmdlets.InstallPackage
 
##[error]PowerShell exited with code '1'.
Finishing: Install-Modules

@SUBnet192
Copy link

Fresh install, exact same issue (Install-Modules section fails) with the @skyblaster 's error message. Any insight?

@SUBnet192
Copy link

SUBnet192 commented Sep 6, 2023

So adding the AllowClobber parameter to the script made it go further. I expected 7ZIP and Notepad++ to be added to our Intune App repository after execution but no such luck.
I do get this warning:
Directory 'C:\ADOAgent_work\1\b' is empty. Nothing will be added to build artifact 'AppsDownloadList'.

@nithilin1
Copy link

Also had original issue with the -allowclobber fixing my installing of prerequest items. Should just be pushed to sourcecode.
Not recognizing the graph issue though.

@nithilin1
Copy link

nithilin1 commented Sep 26, 2023

So adding the AllowClobber parameter to the script made it go further. I expected 7ZIP and Notepad++ to be added to our Intune App repository after execution but no such luck. I do get this warning: Directory 'C:\ADOAgent_work\1\b' is empty. Nothing will be added to build artifact 'AppsDownloadList'.

Ran into same warning in my testing - mine came from my icon wasnt named "icon.png" in one of my application folders. I suggest you go back to check_app_files stage and see if you can spot anything giving you errors there. Not sure if "Enable system diagnostics" in your run pipeline gives you any help. Either way, dont think this is related to the issue with the install-modules or graph errors.

@nithilin1
Copy link

#5 should fix the 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

5 participants