On the local machine I can connect, but then I put program to Azure I get ""ALERT" Please log in via web browser" error.
First log in to the specified account via the web browser, you might have received an email with the blocked attempt information. Review it - you might need to confirm it was you.
There are several ways of dealing with this error:
Please note that contrary to what the label says those applications (such as Thunderbird, Outlook and Mail.dll) are secure – they use TLS or SSL to secure the communication. The label name Gmail uses is misleading and false.
Use OAuth 2.0 (OAuth 2.0 for installed applications, OAuth 2.0 for web applications, OAuth 2.0 for service accounts)
Use application specific passwords (You can find how to create one in the Gmail support site)
In some cases you'll need to use unlock captcha (use incognito mode so you are sure you are logged in to correct account): https://accounts.google.com/DisplayUnlockCaptcha