Reputation: 4665
I have created an Azure-Function app on Azure Portal.
Under D:\home\site\wwwroot
,I have a MyApp
folder and within it an executable My.App.exe
.
I also have in this folder a run.ps1
powershell script and I simply want the powershell script to launch the exe app.
Also I have this function.json :
{
"bindings": [
{
"name": "MyApp",
"type": "timerTrigger",
"direction": "in",
"schedule": "0 */6 * * * *",
"runOnStartup": true
}
]
}
What must I put in the run.ps1 file in order to call the exe app?
I tried & ".\My.App.exe"
and it gives :
2017-02-24T15:15:47.204 Function started (Id=0f4b9b0b-a1f5-4812-9d93-c4017da5ac1c)
2017-02-24T15:15:51.562 & : The term '.\My.App.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
at run.ps1: line 1
+ &
+ _
+ CategoryInfo : ObjectNotFound: (.\My.App.exe:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I also tried ".\My.App.exe"
and it gives :
2017-02-24T15:26:29.312 Function started (Id=dced4842-069b-43c6-a055-aa06a46286c4)
2017-02-24T15:26:29.499 .\My.App.exe
2017-02-24T15:26:29.499 Function completed (Success, Id=dced4842-069b-43c6-a055-aa06a46286c4)
but it's as the exe was never launched because the first line in it is a Console.WriteLine
and the log is empty
What is the correct command to put in the Powershell file?
Upvotes: 2
Views: 4008
Reputation: 23405
Per the discussion in comments, one solution is to use an explicit path:
& 'D:\home\site\wwwroot\MyApp\My.App.exe'
Your Azure function files should always exist under 'D:\home\site\wwwroot\{yourfunctionname}\'
Upvotes: 4