Azure Cloud Service Startup task that needs to run a PowerShell script -
all,
note: have updated question after feedback.
thanks @jisaak far.
i have need run powershell script adds tcp bindings , other stuff when deploy cloud service.
here cloud service project:
here cloud service project , webrole project:
here task in servicedefinition.csdef:
and here powershell script want run:
any appreciated.
i think there following other people syntax on web doesn't seem me there.
thanks russ
i think issue working directory of batch command interpreter when runs startup.cmd runs not expected.
the startup.cmd located in \approot\bin\startup
directory working directory \approot\bin
.
therefore command .\rolestartup.ps1
not able find rolestartup.ps1 looking in bin
directory not in bin\startup
directory.
solutions know are:
solution 1: use ..\startup\rolestartup.ps1
call rolestartup.ps1 startup.cmd.
soltuion 2: change current working directory in startup.cmd relative path .\rolestartup.ps1
found. chdir %~dp0
(see here) change directory contains startup.cmd.
solution 3: don lockhart's answer suggested, not copy startup directory output, instead leave set "content" in visual studio project. means files within exist in \approot\startup
directory on azure instance. (you want make sure startup folder not publically accessible via iis!). update reference startup.cmd in servicedefinition.csdef ..\startup\startup.cmd
, , update reference rolestartup.ps1 in startup.cmd ..\startup\rolestartup.ps1
. works on fact working directory bin
, uses ..\startup
locate startup directory relative it.
Comments
Post a Comment