SCRT-HQ / PSGSuite

Powershell module for Google / G Suite API calls wrapped in handy functions. Authentication is established using a service account via P12 key to negate the consent popup and allow for greater handsoff automation capabilities
https://psgsuite.io/
Apache License 2.0
234 stars 68 forks source link

Setup Guide Unclear / Not up to Date #366

Open magic-happenz opened 2 years ago

magic-happenz commented 2 years ago

Describe the bug I failed multiple times setting this up. There are multiple things that do not work from the https://psgsuite.io/Initial%20Setup/ setup guide beginning with the broken links to create the project which is due to API changes I assume (i.e.: there is no Apps Activity API existing). Then there is no domain wide delegation checkbox anymore in the service account, at least not for me. All in all when following this guide step by step I still end up with error: Exception calling "Execute" with "0" argument(s): "Error:"unauthorized_client", Description:"Client is unauthorized to retrieve access tokens using this method, or client not authorized for any of the scopes requested.", Uri:""" OR Exception calling "Execute" with "0" argument(s): "Error:"invalid_grant", Description:"java.security.SignatureException:

To Reproduce Steps to reproduce the behavior:

  1. Setup environment according to https://psgsuite.io/Initial%20Setup/
  2. Set-PSGSuiteConfig
  3. Get-GSUserList
  4. Error

Expected behavior Get a list of users from my GSuite tenant.

Environment (please complete the following information):

jgeron-suhsd commented 2 years ago

Directions are mostly unclear and do need updating, but if you're able to mostly get through it and are able to run get-gsuser to return information about your admin account, try the following:

I was having this exact issue tonight on one of several domains that I work with. My problem was my CustomerID was incorrect. Double check your CustomerID in your PSGSuiteConfig.

Assuming you can run Get-GSUser, you should be able to find your CustomerID.

Then run Set-PSGSuiteConfig -ConfigName NameOfYourConfig -CustomerID YourCustomerID -Preference CustomerID

Then try running Get-GSUserList again. Should be all set.

magic-happenz commented 2 years ago

Thanks for the tip but I am wondering how to do this if the config is not working? If you can run Get-GSUser you acutally already made it. My problem is that no config worked. BTW you can obtain it from https://admin.google.com/ac/accountsettings/profile. Would be good to acutally mention this in the guide...

However, after hours and hours of investigation I finally made it working. Here some tips for anyone who have to use it in the future:

Hope that helps anyone and that this guide could be updated to avoid the hard time people have that need to use it.

jgeron-suhsd commented 2 years ago

FYI - I run the module in VSCode without any issues, so I'm not sure what you're problem is in that regard.

magic-happenz commented 2 years ago

Yes could be but at least for me some commands I run into errors on VSCode while they work in Powershell.

tekuadam commented 1 year ago

For more info - In VSCode I get the following specifically when running it in the PowerShell Integrated Console:

image

Get-GSGmailProfile : The value supplied is not valid, or the property is read-only. Change the value, and then try again.
At line:1 char:1
+ Get-GSGmailProfile
+ ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Get-GSGmailProfile

If I run the same in the powershell terminal it works fine.

image

I've had this in the past with other modules, I assume due to the way the PowerShell extension handles modules.