开发者

Azure: access ServiceConfiguration.cscfg from startup.cmd?

开发者 https://www.devze.com 2023-03-12 03:00 出处:网络
Does a开发者_Python百科nyone know if it is possible to access the ServiceConfiguration.cscfg from the startup.cmd of a role?

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

精彩评论

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