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 66 forks source link

License SKUs #269

Closed Foggy2 closed 4 years ago

Foggy2 commented 4 years ago

Hi @scrthq

Have been starting to work through some processes with the updated license types.

Just wondering how you arrived at the names that are accepted as input to the -license parameter?

For example, when I use add the license type 'GSuiteEnterpriseforEducationStudent' to a user I am returned the below SKU name and ID. image

To help going forward with consistency. I am wondering how you arrived at 'GSuiteEnterpriseforEducationStudent' when the SKU name is actually 'G Suite Enterprise for Education (Student)'?

Is it simply a case of you removing any special characters and whitespace so that the value is in a better format for use in parameters?

If so, going forward if there are other licenses that include special characters would it be fair to say that they would be formatted in the same manner for the -license parameter?

Thanks!

scrthq commented 4 years ago

Hey @Foggy2 - There was a bit of an overhaul recently in regards to the license skus and I added support for a multitude of different license aliases based on what is currently available in GAM-ADVX. In short, Google only accepts SkuId, but for some license sku's (e.g. G Suite Enterprise for Education (Student)), the license sku isn't very memorable, so friendly names were added to the parameter's ValidateSet. Since tab-completing parameter values can be painful when there are spaces and special characters, everything not an alphanumeric character is trimmed out from the SkuName. If we only allow what Google expects, you'd need to use 1010310003 for the license type.

scrthq commented 4 years ago

https://github.com/SCRT-HQ/PSGSuite/blob/master/PSGSuite/Private/LicenseHelpers.ps1

Here are the helper functions which provide tab-completion for the License functions, for reference

Foggy2 commented 4 years ago

That is great. That is what I thought would be the case. Thanks for confirming.