Differences
This shows you the differences between the selected revisions of the page.
2016-11-22 | 2016-12-21 | ||
link update (martin) | updating for the new portal (martin) | ||
Line 15: | Line 15: | ||
* Pack all the job files into a ZIP archive; | * Pack all the job files into a ZIP archive; | ||
- | * Navigate to your web site page on [[https://manage.windowsazure.com/|Azure Management Portal]]; | + | * Navigate to your web site page on Azure Portal ''portal.azure.com''/Azure Management Portal ''manage.windowsazure.com''; |
- | * Switch to //WebJobs// tab; | + | * Switch to //WebJobs// page/tab; |
- | * Use //Add// command on bottom bar; | + | * Use //Add// command on top/bottom bar; |
* Give your WebJob a name; pick your ZIP archive and set up how the job is run. | * Give your WebJob a name; pick your ZIP archive and set up how the job is run. | ||
Line 32: | Line 32: | ||
<code winscp> | <code winscp> | ||
- | open ftps://winscp\winscp:mypassword@waws-prod-am1-234.ftp.azurewebsites.windows.net/ | + | open ftpes://winscp\winscp:mypassword@waws-prod-am1-234.ftp.azurewebsites.windows.net/ |
put C:\myjob\* /site/wwwroot/App_Data/jobs/type/name/ | put C:\myjob\* /site/wwwroot/App_Data/jobs/type/name/ | ||
exit | exit | ||
Line 59: | Line 59: | ||
===== [[log]] Copying Session Log to Job Log ===== | ===== [[log]] Copying Session Log to Job Log ===== | ||
- | The standard output of the job is redirected to a log file which you can display on Azure Management Portal. | + | The standard output of the job is redirected to a log file which you can display on Azure Portal. |
It is useful to have WinSCP session log file included into the job's log. For that as the last step of the job, print the WinSCP session log to the standard output. See [[#implementation|implementation sections]] below for examples. | It is useful to have WinSCP session log file included into the job's log. For that as the last step of the job, print the WinSCP session log to the standard output. See [[#implementation|implementation sections]] below for examples. | ||
- | To display the job log, go to //WebJobs// tab of your web site page on Azure Management Portal and click on a link in //Logs// column of the job. | + | To display the job log, go to //WebJobs// page of your web site on Azure Portal, select the job and click on the //Logs// button on the top bar. |
===== [[implementation]] Implementation ===== | ===== [[implementation]] Implementation ===== | ||
Line 78: | Line 78: | ||
* enable session logging to a unique job run directory (''%WEBJOBS_DATA_PATH%\%WEBJOBS_RUN_ID%''); | * enable session logging to a unique job run directory (''%WEBJOBS_DATA_PATH%\%WEBJOBS_RUN_ID%''); | ||
* locate source or destination paths of the transfer using WebJob [[#environment|environment variables]]; | * locate source or destination paths of the transfer using WebJob [[#environment|environment variables]]; | ||
- | * [[#log|print the session log to the standard output]], so that it is available from Azure Management Portal. | + | * [[#log|print the session log to the standard output]], so that it is available from Azure Portal. |
An example script (''script.txt'') that backs up the WebSite to a remote SFTP server: | An example script (''script.txt'') that backs up the WebSite to a remote SFTP server: | ||
Line 133: | Line 133: | ||
* enable session logging to a unique job run directory (''%WEBJOBS_DATA_PATH%\%WEBJOBS_RUN_ID%''); | * enable session logging to a unique job run directory (''%WEBJOBS_DATA_PATH%\%WEBJOBS_RUN_ID%''); | ||
* locate source or destination paths of the transfer using WebJob [[#environment|environment variables]]; | * locate source or destination paths of the transfer using WebJob [[#environment|environment variables]]; | ||
- | * [[#log|print the session log to the standard output]], so that it is available from Azure Management Portal; | + | * [[#log|print the session log to the standard output]], so that it is available from Azure Portal; |
* not use ''[[ps>microsoft.powershell.utility/write-host|Write-Host]]'' cmdlet as there is no console to write to in the Azure WebJob, use ''[[ps>microsoft.powershell.utility/write-output|Write-Output]]'' instead. | * not use ''[[ps>microsoft.powershell.utility/write-host|Write-Host]]'' cmdlet as there is no console to write to in the Azure WebJob, use ''[[ps>microsoft.powershell.utility/write-output|Write-Output]]'' instead. | ||
Line 220: | Line 220: | ||
* enable session logging to a unique job run directory (''%WEBJOBS_DATA_PATH%\%WEBJOBS_RUN_ID%''); | * enable session logging to a unique job run directory (''%WEBJOBS_DATA_PATH%\%WEBJOBS_RUN_ID%''); | ||
* locate source or destination paths of the transfer using WebJob [[#environment|environment variables]]; | * locate source or destination paths of the transfer using WebJob [[#environment|environment variables]]; | ||
- | * [[#log|print the session log to the standard output]], so that it is available from Azure Management Portal or provide other means for accessing the log. | + | * [[#log|print the session log to the standard output]], so that it is available from Azure Portal or provide other means for accessing the log. |
An example C# code that backs up the WebSite to a remote SFTP server: | An example C# code that backs up the WebSite to a remote SFTP server: | ||
Line 310: | Line 310: | ||
* optionally [[public_key|a private key file]] for SSH authentication. | * optionally [[public_key|a private key file]] for SSH authentication. | ||
- | You can develop the WebJob (console) application as any other, even using //Visual Studio Express for Windows Desktop//. If you are using //Visual Studio Express for Web//, you can use //Microsoft Azure WebJob// project template. It's basically the same template as a //Console Application// in the Desktop edition.((Web edition does not have //Console Application// template.)) | + | You can develop the WebJob (console) application as any other, even using //Visual Studio Express for Windows Desktop//. If you are using //Visual Studio Express for Web//, you can use //Azure WebJob// project template. It's basically the same template as a //Console Application// in the Desktop edition.((Web edition does not have //Console Application// template.)) |
- | With //Visual Studio Express for Web// (2013 edition with Update 3)((For older versions you need Azure SDK.)) you can ease [[#deploying|the deployment]] using command //Publish as Azure WebJob//, which is available in the project context menu in //Solution Explorer//. It opens //[[https://docs.microsoft.com/en-us/azure/app-service-web/websites-dotnet-deploy-webjobs#configure|Add Azure WebJob]]// dialog that allows you to name your job and setup how it is run (including scheduling). Make sure you add all additional files needed for the job (i.e. ''winscp.exe'', ''run.bat'' and private key, as shown above) to the project with //Build Action// set to //Content// to have them deployed (see also [[library_install#vs|Using WinSCP .NET assembly from Visual Studio]]). When you submit the dialog, a publish process starts on the background in //Web Publish Activity// pane. Next time you publish, after making changes to the project, only modified files are uploaded. See also [[https://docs.microsoft.com/en-us/azure/app-service-web/websites-dotnet-deploy-webjobs|How to Deploy Azure WebJobs to Azure Websites]]. | + | With //Visual Studio Express for Web// (2013 edition with Update 3 and newer)((For older versions you need Azure SDK.)) you can ease [[#deploying|the deployment]] using command //Publish as Azure WebJob//, which is available in the project context menu in //Solution Explorer//. It opens //[[https://docs.microsoft.com/en-us/azure/app-service-web/websites-dotnet-deploy-webjobs#configure|Add Azure WebJob]]// dialog that allows you to name your job and setup how it is run (including scheduling). Make sure you add all additional files needed for the job (i.e. ''winscp.exe'', ''run.bat'' and private key, as shown above) to the project with //Build Action// set to //Content// to have them deployed (see also [[library_install#vs|Using WinSCP .NET assembly from Visual Studio]]). When you submit the dialog, a publish process starts on the background in //Web Publish Activity// pane. Next time you publish, after making changes to the project, only modified files are uploaded. See also [[https://docs.microsoft.com/en-us/azure/app-service-web/websites-dotnet-deploy-webjobs|How to Deploy Azure WebJobs to Azure Websites]]. |
===== Further Reading ===== | ===== Further Reading ===== |