question

DavidDowning-2679 avatar image
0 Votes"
DavidDowning-2679 asked Grmacjon-MSFT commented

How do I allow my WebJob access to SQL databases running on Azure VMs?

I am developing several Azure WebJobs that need to read SQL databases that are running on Azure VMs.

Can I specify the credentials used when running the WebJob? If not, what is the recommended approach? My goal is to be able to use a SQL connection string in my console app that doesn't contain user id/password.

Thank you.

azure-webapps-webjobs
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.

1 Answer

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

Hi @DavidDowning-2679,

Currently, the WebJobs SDK only supports Azure Storage (tables, blobs, queues ). It does not support SQL databases as triggers. However, you can run SQL Azure in your executable code within the webjob itself. Please view this workaround in this related SO thread.

Hope that helps. Let us know if you have further questions.

Thanks,
Grace


· 2
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.

Hello @Grmacjon-MSFT,

Thank you for your response... I should have been a bit clearer in my question.

I'm not looking for a trigger; I'm looking for a way to use a secure SQL connection string in my console app. I do not want to include a user id/password in the connection string.

0 Votes 0 ·

Thanks for the clarification @DavidDowning-2679. You could try utilizing managed identities to access App Configuration. Check out this tutorial: https://docs.microsoft.com/en-us/azure/app-service/overview-managed-identity?tabs=dotnet#obtain-tokens-for-azure-resources

This tutorial shows you how to create a managed identity for App Service & Azure Functions applications and how to use it to access other resources.

0 Votes 0 ·