The script will connect to your tenant and allow each Distribution Group to receive email from an external address, rather than only from within your Org which is the default.
The script supports the –CSV parameter, this is for when you just want to externally enable a subset of distribution groups as you do actually want some to be internal only.
Anyhow here's a quick guide to the script in action.
Take some time to read the intro – it does give you some good information like, for example, the –CSV switch. Hit Y to continue
Once you've said Y, it will ask you for the tenant domain, now I have done this because if you're using an account that isn't an admin of the tenant (or an account with the relevant RBAC rights), you can actually connect to a tenant under the Partner model
It will ask you to confirm you details, Y to continue
Enter your credentials for the tenant
It will now connect to Exchange Online
And prompt you to confirm you've connected to the right tenant (again if you're going in with your Partner Admin credentials over a tenant you are helping to administer)
Hit Y to start making the changes
Once it has completed it will give you a summary of the total number of distribution groups found, and the changes made, and also give you a total of any that have not had any changes made (which will be ZERO unless you have used the –CSV option)
If you want to only enable it for certain distribution groups use the –CSV switch and create a CSV with a column for 'Identity' and the names of the Distribution Groups.
If you are running direction synchronisation with AADSync or AADConnect, and synchronising Groups, then this script isn't for you, you must make the change on-premises and the change will be synchronised to Exchange Online. If your Groups are Cloud based however, and you're only synchronising Users - then this will work for you.
Oliver Moazzezi – MVP Exchange Server