Details of the scenario you tried and the problem that is occurring
The SqlServerDatabaseMail resource only supports connecting to SMTP servers that do not require authentication, and does not allow for defining a username and password for the SMTP connection. Depending on the user's environment, this could be a requirement of using DatabaseMail, but another example use case would be for using an email testing service like mailtrap.io, which uses unique SMTP credentials to send incoming emails to one organization's user account or another.
Verbose logs showing the problem
N/A
Suggested solution to the issue
Microsoft.SqlServer.Management.Smo.Mail.MailServer contains settable properties for UseDefaultCredentials and UserName, and provides a method for SetPassword.
Rudimentary testing suggests that if the account requires a password, it must be set for the SMO object regardless of which property is being altered, else the password for the account is unset.
The DSC configuration that is used to reproduce the issue (as detailed as possible)
N/A
SQL Server edition and version the target node is running
N/A
SQL Server PowerShell modules present on the target node
N/A
The operating system the target node is running
N/A
Version and build of PowerShell the target node is running
N/A
Version of the DSC module that was used ('dev' if using current dev branch)
Details of the scenario you tried and the problem that is occurring
The SqlServerDatabaseMail resource only supports connecting to SMTP servers that do not require authentication, and does not allow for defining a username and password for the SMTP connection. Depending on the user's environment, this could be a requirement of using DatabaseMail, but another example use case would be for using an email testing service like mailtrap.io, which uses unique SMTP credentials to send incoming emails to one organization's user account or another.
Verbose logs showing the problem
N/A
Suggested solution to the issue
Microsoft.SqlServer.Management.Smo.Mail.MailServer contains settable properties for UseDefaultCredentials and UserName, and provides a method for SetPassword.
Rudimentary testing suggests that if the account requires a password, it must be set for the SMO object regardless of which property is being altered, else the password for the account is unset.
The DSC configuration that is used to reproduce the issue (as detailed as possible)
N/A
SQL Server edition and version the target node is running
N/A
SQL Server PowerShell modules present on the target node
N/A
The operating system the target node is running
N/A
Version and build of PowerShell the target node is running
N/A
Version of the DSC module that was used ('dev' if using current dev branch)
dev