You can fully automate the script, and thereby avoid the Office 365 credentials dialog box by providing the credentials as parameters.Use the AuthenticationEmail parameter to specify the Office 365 account email and the AuthenticationEmailPassword parameter to specify the Office 365 account password. Note, that the latter parameter should be a SecureString.

See Also