Created
November 17, 2021 01:15
-
-
Save piratecarrot/d7ca573631c7eb6daee8077708383bb7 to your computer and use it in GitHub Desktop.
Add Google Workspace DNS records
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
resourceGroup="my-resource-group" | |
sites=("test.com" "test.net" "test.org") | |
mailExchanges=("aspmx4.googlemail.com" "alt2.aspmx.l.google.com" "aspmx2.googlemail.com" "aspmx3.googlemail.com" "aspmx.l.google.com" "alt1.aspmx.l.google.com" "aspmx5.googlemail.com") | |
preferences=( 30 20 30 30 10 20 30 ) | |
for site in ${sites[@]}; do | |
for i in ${!mailExchanges[@]}; do | |
az network dns record-set mx add-record \ | |
--resource-group ${resourceGroup} \ | |
--zone-name ${site} \ | |
--record-set-name "@" \ | |
--exchange ${mailExchanges[$i]} \ | |
--preference ${preferences[$i]} | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment