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

[Bug] monkey365 does not work in PS core - MacOS #81

Closed
master-qwerty opened this issue Jan 2, 2024 · 6 comments
Closed

[Bug] monkey365 does not work in PS core - MacOS #81

master-qwerty opened this issue Jan 2, 2024 · 6 comments
Assignees
Labels
bug Something isn't working no-issue-activity

Comments

@master-qwerty
Copy link

master-qwerty commented Jan 2, 2024

What happened?
A clear and concise description of what the bug is or what is not working as expected
Trying to get compliance assessment from tenant via device auth code. But getting error as shown below.

How to reproduce it
Steps to reproduce the behavior:

  1. What command are you running?
$param = @{
    Instance       = 'Microsoft365';
    Analysis       = 'PurView';
    DeviceCode     = $true;
    ExportTo       = @("CSV", "JSON", "HTML");
}
Invoke-Monkey365 @param
  1. See error
pwsh:
Line |
 661 |              pwsh -args @($files) -Command $ScriptBlock
     |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Unable to find type [Microsoft.Identity.Client.PublicClientApplicationOptions].
InvalidOperation: /usr/local/microsoft/powershell/7/Modules/monkey365/core/init/Initialize-AuthenticationParam.ps1:40
Line |
  40 |  … lications = [System.Collections.Generic.List[Microsoft.Identity.Clien …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Unable to find type [System.Collections.Generic.List].
InvalidOperation: /usr/local/microsoft/powershell/7/Modules/monkey365/core/init/Initialize-AuthenticationParam.ps1:41
Line |
  41 |  … lications = [System.Collections.Generic.List[Microsoft.Identity.Clien …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Unable to find type [System.Collections.Generic.List].
New-Object: /usr/local/microsoft/powershell/7/Modules/monkey365/core/init/Initialize-AuthenticationParam.ps1:44
Line |
  44 |  … pMetadata = New-Object -TypeName "System.Management.Automation.Comman …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Exception calling ".ctor" with "1" argument(s): "Unable to find type [Microsoft.Identity.Client.AzureCloudInstance]."
PropertyNotFoundException: /usr/local/microsoft/powershell/7/Modules/monkey365/core/init/Initialize-AuthenticationParam.ps1:47
Line |
  47 |          $param = $msalAppMetadata.Parameters.Keys
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | The property 'Parameters' cannot be found on this object. Verify that the property exists.
InvalidOperation: /usr/local/microsoft/powershell/7/Modules/monkey365/core/init/Initialize-AuthenticationParam.ps1:48
Line |
  48 |          foreach($p in $param.GetEnumerator()){
     |                        ~~~~~~~~~~~~~~~~~~~~~~
     | You cannot call a method on a null-valued expression.
InvalidOperation:
Line |
  76 |          [Microsoft.Identity.Client.AzureCloudInstance]$Environment =  …
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Unable to find type [Microsoft.Identity.Client.AzureCloudInstance].
PropertyNotFoundException: /usr/local/microsoft/powershell/7/Modules/monkey365/core/init/Initialize-AuthenticationParam.ps1:65
Line |
  65 |              $O365Object.isConfidentialApp = -NOT $O365Object.msalappl …
     |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | The property 'isPublicApp' cannot be found on this object. Verify that the property exists.
New-Object: /usr/local/microsoft/powershell/7/Modules/monkey365/core/init/Initialize-AuthenticationParam.ps1:67
Line |
  67 |  … pMetadata = New-Object -TypeName "System.Management.Automation.Comman …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Exception calling ".ctor" with "1" argument(s): "Unable to find type [Microsoft.Identity.Client.AuthenticationResult]."
PropertyNotFoundException: /usr/local/microsoft/powershell/7/Modules/monkey365/core/init/Initialize-AuthenticationParam.ps1:70
Line |
  70 |              $param = $msalAppMetadata.Parameters.Keys
     |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | The property 'Parameters' cannot be found on this object. Verify that the property exists.
InvalidOperation: /usr/local/microsoft/powershell/7/Modules/monkey365/core/init/Initialize-AuthenticationParam.ps1:71
Line |
  71 |              foreach($p in $param.GetEnumerator()){
     |                            ~~~~~~~~~~~~~~~~~~~~~~
     | You cannot call a method on a null-valued expression.
InvalidOperation: /usr/local/microsoft/powershell/7/Modules/monkey365/core/init/Initialize-AuthenticationParam.ps1:84
Line |
  84 |  …             [void]$O365Object.msal_public_applications.Add($O365Objec …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | You cannot call a method on a null-valued expression.
InvalidOperation:
Line |
1645 |          [Microsoft.Identity.Client.AzureCloudInstance]$Environment =  …
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Unable to find type [Microsoft.Identity.Client.AzureCloudInstance]

Expected behavior
A clear and concise description of what you expected to happen.
Trying to get compliance assessment from tenant via device auth code.

Screenshots or Logs
If applicable, add screenshots to help explain your problem.
Also, you can add logs (Please anonymize them first!). The following command may help to share a log
Invoke-Monkey365 -Instance...... -Verbose -Debug -InformationAction Continue -WriteLog then attach here monkey365_exceptions_%date%.log
Log file is empty.

From where are you running Monkey365?
Please, complete the following information:

  • Resource: [Docker container, workstation) workstation. Module installation path:
/usr/local/microsoft/powershell/7/Modules/monkey365

$env:PSModulePath -split ":"                                                                                                                                                                          
/usr/local/microsoft/powershell/7/Modules
  • OS: MacOS 14.2.1
  • PowerShell Version [$PsVersionTable]:
Name                           Value
----                           -----
PSVersion                      7.4.0
PSEdition                      Core
GitCommitId                    7.4.0
OS                             Darwin 23.2.0 Darwin Kernel Version 23.2.0: Wed Nov 15 21:53:18 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6000
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
  • Monkey365 Version: v0.91.2-beta
  • Others:

Additional context
Add any other context about the problem here.

@master-qwerty master-qwerty added bug Something isn't working status/needs-triage Needs triage labels Jan 2, 2024
@silverhack silverhack removed the status/needs-triage Needs triage label Jan 2, 2024
@silverhack
Copy link
Owner

Hi @master-qwerty, thanks for submitting this, it's really appreciated.

Without test it, I believe that the issue is that Monkey365 is unable to determine that OS is MacOS and then is unable to load the NET core library for MSAL.

I'll review the code and I will try to update a patch asap.

Cheers,

@silverhack
Copy link
Owner

Hi @master-qwerty,

Please, note that although .NET core is supported in MacOS, Monkey365 does not support it. Having said that, it's a bug and the develop branch was updated. Could you please test it and do let me know?

Thanks,

@master-qwerty
Copy link
Author

Thanks, tested with following results.

  1. Error-related to missing files/folders. I've fixed that by copying it from the main branch.
Import-Module monkey365                                                                                                                                    13:34:59
MethodInvocationException: Exception calling "EnumerateFiles" with "3" argument(s): "Could not find a part of the path '/usr/local/microsoft/powershell/7/Modules/monkey365/core/watcher'."
  1. Some errors during run, however html report is there and is valid (checked against the one from Windows).
Invoke-Monkey365 @param                                                                                                                                    13:38:10
pwsh:
Line |
 664 |                  pwsh -args @($files) -Command $ScriptBlock
     |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Unable to find type [Microsoft.Identity.Client.PublicClientApplicationOptions].
WARNING: [12:38:15:189] - [monkeymsal.psm1] - Unable to determine if OS is Windows or Linux. Loading MSAL Core - warning - -
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code to authenticate.
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code to authenticate.
Write-Error:
Line |
1594 |              Write-Error ($script:messages.UnableToExportObject -f $Ou …
     |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | [12:39:45:574] - [Out-JSON] - Unable to export /usr/local/microsoft/powershell/7/Modules/monkey365/monkey-reports/4e1130d9-e166-4450-a191-c4edf1bc6d17/json/o365_secomp_dlp_sinfo_type.json - error -  -
SCR-20240103-mges-2

@silverhack
Copy link
Owner

Hey @master-qwerty thanks for the update!

Yep, the JSON issue is related to Improve CSV and JSON output issue and that will be fixed in next version.

Cheers,

@silverhack silverhack self-assigned this Jan 9, 2024
Copy link
Contributor

github-actions bot commented May 9, 2024

This issue has been automatically marked as stale because it has not had recent activity. We kindly ask you to check again if the issue you reported is still relevant in the current version of Monkey 365. If it is, update this issue with a comment, otherwise it will be automatically closed if no further activity occurs. Thank you for your contributions.

Copy link
Contributor

This issue was closed because it has been inactive for 14 days since being marked as stale. If the issue is still relevant, feel free to re-open it or open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working no-issue-activity
Projects
None yet
Development

No branches or pull requests

2 participants