Applying Licenses to Groups with GAM
We had a need to do some automation when it came to licensing in Google Workspaces. Unfortunatley, the Google Admin Console only allows super admins to apply licenses and there’s no easy way to do it with what Google provides and Google does not allow assigning licenses by using groups either.
To get around this limitation, we’ll be using GAM!
To begin, we created a group called license_TeachersLearningUpgrade. Anyone added to this group will be assigned the Teachers and Learning Upgrade License once the group is sync’d using GAM and vise-versa for removing the license.
Adding Users to the Group
You can add users to the group manually or you can use GAM.
To add an individual user:
gam update group license_TeachersLearningUpgrade add member user@emailaddress.com
To bulk add users with a CSV file:
gam csv file.csv gam update group license_TeachersLearningUpgrade add user ~EmailAddress
We’re using a column within the CVS file called EmailAddress. If you’re using something different, change ~EmailAddress in the above command to match.
Removing Users from the Group
To remove an individual user:
gam update group license_TeachersLearningUpgrade delete member user@emailaddress.com
To bulk remove users from a CSV file:
gam csv file.csv gam update group license_TeachersLearningUpgrade delete user ~EmailAddress
License Sync
Once all the users have been added or removed from the group, we can run a license sync against the group to assign/unassign those licenses.
gam group license_TeachersLearningUpgrade sync license 1010370001
The above command utilizes the license SKU ID for the Teachers and Learning Upgrade group. Other SKU’s can be found here: https://developers.google.com/admin-sdk/licensing/v1/how-tos/products
Once the command has completed, the user accounts can be double check to ensure the license was added or removed by either refreshing the user’s page in the Admin Console or by running the command below: The last line will output any licenses attached to the account.
gam user info user@emailaddress.com