question

MSProg-4478 avatar image
0 Votes"
MSProg-4478 asked OuryBa-MSFT commented

Database Mail with Key Vault

Database Mail with Key Vault

Hi
We are in the process of migrating our on-prem sql to Azure SQL Managed instance. we are using the database mail feature. One of the steps while configuring the Database Mail is creating a database mail account

  • Create a Database Mail account
    EXECUTE msdb.dbo.sysmail_add_account_sp
    @account_name = '...',
    @description = '...',
    @email_address = '$(loginEmail)',
    @display_name = '...',
    @mailserver_name = '$(mailserver)' ,
    @username = '$(loginEmail)' ,
    @password = '$(password)'

as you see above, we need to pass in the username and password to sysmail_add_account_sp. This , i think , will store all the parameters in some internal sql tables.

Now we have a security guideline that says all passwords are to be stored only in the azure keyvault. And we have been asked to explore if the above database mail account can be setup with a password stored in keyvault rather than directly passing it to the sp like in the code above.

is this possible at all? any guidance here will be greatly appreciated.

thanks





sql-server-generalazure-sql-database
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@MSProg-4478 Welcome to Microsoft Q&A and Thank you for posting your question.
We are reviewing your question and will circle back at the possible earliest time. Thanks

0 Votes 0 ·

1 Answer

OuryBa-MSFT avatar image
0 Votes"
OuryBa-MSFT answered OuryBa-MSFT commented

@MSProg-4478 there is no way to store DB mail password in AKV, as there is no integration between Azure SQL Managed Instance DB Mail and AKV. With MI, two available auth options for dbmail are anonymous (no auth) or basic (user name and password).
With basic auth , we will advise to use dedicated email account with unique password that's preferably rotated on a regular basis. Please let me know if you have any questions. Thanks

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@MSProg-4478 Please do let us know if you have any further query. Please mark posts as answer if it answers your query. This would be helpful for others community members facing the same kind of problem. Thanks

0 Votes 0 ·