When you want to do something in Azure AD, you often need the Tenant ID. This function can be included in your script. Just type in a domain and it returns the Tenant ID.
Check my repo on GitHub, to get the latest updates in case I create some new options or change the standard folders.