开发者

Azure: access ServiceConfiguration.cscfg from startup.cmd?

Does a开发者_Python百科nyone know if it is possible to access the ServiceConfiguration.cscfg from the startup.cmd of a role?

Is the ServiceConfiguration.cscfg placed any where on the physical VM of the role?

Thanks!


Create a startup script that fires a powershell script:

powershell.exe Set-ExecutionPolicy Unrestricted
powershell.exe .\mypsscript.ps1 >> ..\startup-tasks-log.txt 2>>..\startup-tasks-error-log.txt

Then, in the PowerShell script, you can easily access the RoleEnvironment class (and config values as well):

[Reflection.Assembly]::LoadWithPartialName("Microsoft.WindowsAzure.ServiceRuntime")

$roleInstanceId = [Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment]::CurrentRoleInstance.Id
$appTitle = [Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment]::GetConfigurationSettingValue("AppTitle")

etc.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜