I am publishing my console application as an Azure WebJob. I would like to run the webjob every day at 0.30 am. But just for testing, I am trying currently with every 5 minutes. Which works fine. But I also want to use an argument, which is passing to the arg[0] to my static void Main(string[] args)
method.
My Web Deploy.pubxml
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>MSDeploy</WebPublishMethod>
<ADUsesOwinOrOpenIdConnect>False</ADUsesOwinOrOpenIdConnect>
<PublishProvider>AzureWebSite</PublishProvider>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish>http://testProjectHello.azurewebsites.net</SiteUrlToLaunchAfterPublish>
<LaunchSiteAfterPublish>False</LaunchSiteAfterPublish>
<MSDeployServiceURL>testProjectHello.scm.azurewebsites.net:443</MSDeployServiceURL>
<DeployIisAppPath>testProjectHello</DeployIisAppPath>
<SkipExtraFilesOnServer>True</SkipExtraFilesOnServer>
<MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
<UserName>$testProjectHello</UserName>
<_SavePWD>True</_SavePWD>
<_DestinationType>AzureWebSite</_DestinationType>
</PropertyGroup>
</Project>
webjob-publish-settings.json:
{
"$schema": "http://schemastore.org/schemas/json/webjob-publish-settings.json",
"webJobName": "webjobNameTest",
"runMode": "OnDemand"
}
My settings.job file:
{
"schedule": "0 */5 * * * *"
}
In the azure portal I see the following:
NAME TYPE STATUS SCHEDULE
webJobNameTest Triggered Ready 0 */5 * * * *
How can I pass an argument in my web job? Is it also possible to deploy multiple azure web jobs with different parameters from one console application? So I can run the webjob every day, and every week and every month. Including a parameter so my logic knows whether to get the day, week or month data.