cisagov / ScubaGoggles

SCuBA Secure Configuration Baselines and assessment tool for Google Workspace
https://www.cisa.gov/resources-tools/services/secure-cloud-business-applications-scuba-project
Creative Commons Zero v1.0 Universal
164 stars 22 forks source link

Collect License Information #81

Open amart241 opened 11 months ago

amart241 commented 11 months ago

Hi Team,

See the below from Grant via the M365 Github repo. Just sending along so we can get ahead of this one in terms of whether or not Goggles could even do this.

adhilto commented 3 months ago

Looks like this can be done using the reseller API.

  1. Get all subscriptions: https://developers.google.com/admin-sdk/reseller/v1/how-tos/manage_subscriptions#retrieve_all_subscriptions_for_a_customer
  2. For loop on all subscriptions found in step 1 and use this call https://developers.google.com/admin-sdk/reseller/v1/how-tos/manage_subscriptions#retrieve_a_subscription, note numberofSeats and licensedNumberOfSeats

See https://developers.google.com/admin-sdk/reseller/reference/rest/v1/subscriptions#Seats for definition of those fields.

adhilto commented 3 months ago

Upon a closer look I don't think we'll be able to use that API. "You must have a fully executed and signed reseller contract to use the Partner Sales Console and the Reseller API."

https://developers.google.com/admin-sdk/reseller/v1/how-tos/prerequisites

adhilto commented 3 months ago

Looks like we could also do it via the reports API: https://stackoverflow.com/questions/68341392/how-can-i-get-available-license-via-google-workspace-admin-sdk