I have a web app in azure.
My solution is something below:
- MyApp.Web
- MyApp.WebjobTasks
- MyApp.WebjobAnotherTask
The webjobs are part of the web application. They all share the same Data layer to access data by Entity Framework and in Azure portal when App settings are defined the app settings are overrides in all projects web app and web jobs config files.
All projects has a connection string key as "DefaultConnection" for to the same database.
But I would like to change the user (that has more privileges to do housekeeping) for webjobs. So Webjob should be able to ALTER/Truncate tables whereas MyApp.Web should only have the db_datareader and _db_datawriter roles.
How can I diverse this? If I change the connection string key in Azure portal to use a user that has permission to alter database then this is not a good solution that public faced application will be given unnecessary permissions.
Wouldn't be nice that each application should have their own App Settings page in Azure portal. So that each application could be run different user permissions.
Is there any better way to achieve this? Or I should be adding new user and password keys to app.config for webjobs and read those keys to update connection string before running house keeping jobs?