Troubleshooting: Avoiding the Microsoft 365 Credentials Dialog box

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

See Also

How to: Set up Microsoft Dynamics NAV for Single Sign-on With Microsoft 365 using Windows PowerShell
Authenticating Users with Azure Active Directory