Thanks for pitching in everyone! Your input was helpful, however I would like to update the answer with the solution I found that was so easy and saved me so much time. I will like to update you on how I could successfully deploy the app service and web job in a single go. Its very easy and since it deploys web app and corresponding web jobs in a single go, this was the perfect solution for my scenario. Thanks to my colleague who helped me with this solution. The following depicts the steps I had to go through.
Lets suppose that my app service in Azure is “appService1” and I want to create a triggered web job under appService1 that goes by the name “webJob1”. I followed zip-deployment with azure cli.
- Publish your web application (For the app service) solution in release mode to get the files you will have to deploy. Let this folder be WebAppBuild.
- Build your application (a console application in my case) that would serve as the web job for the app service in release mode.
- Inside the published folder for the web application (for app service ie WebAppBuild in our example), add a folder with the following path
(If you need more than one web jobs deployed, you can create more than one folders like webJob2, webJob3 etc)
Add the files you have in step 2 to this folder. This is basically the files needed for your web job
- Zip the contents in a single folder that acts as your deployment folder for web app and web job
- Go to powershell and run az login (works if you have installed azure cli, otherwise you will have to install it as well)
- Log into your respective account with the prompt window
- Run the following commands that sets run from package property to true for your web app and the second command is the actual deployment command
az webapp config appsettings set --resource-group <<resourceGroupName>> --name <<appServiceName>> --settings WEBSITE_RUN_FROM_PACKAGE="1" ; az webapp deployment source config-zip --resource-group <<resourceGroupName>> --name <<appServiceName>> --src <<zipFilePath>>
- Now login to your azure portal and navigate to your web app. Check under web jobs option and you will see that the web job has been created with the files you deployed.
For more help on starting, stopping, deleting the web job with azure cli, go through the following document. Check here
CLICK HERE to find out more related problems solutions.