Automating Google Workspace Domain Management with Python CLI
Managing multiple domains in Google Workspace can be a tedious and error-prone process. This is especially true when dealing with ten, twenty, or more domains across several brands. Each domain requires administrators to prove ownership, publish a DNS record, wait for propagation, return to Google Workspace, add the domain, configure mail routing, and verify the result.
A team of developers has created a Python CLI tool that automates this process using a CSV file as input. The tool connects the Google Site Verification API, GoDaddy Domains API, and Google Workspace Admin SDK Directory API to perform the necessary steps for each domain. This includes verifying ownership, creating TXT records, polling public DNS until the token is visible, asking Google to verify ownership, and configuring mail routing.
The tool uses interactive OAuth authentication instead of service-account keys, which are considered less secure. It also treats every write operation as something to check before doing, ensuring that any changes are inspected and validated before being applied.