FAQ: How Do I Avoid Deploying the Retrace Agent in Azure On Roles That I Do Not Want to Monitor?

If you followed our instructions for deploying to Azure roles but want to make sure that you don’t install the agent on certain roles (roles used for Dev or QA for example), you can do something like the following to perform a selective deployment.

Selective Deployment Instructions

1. Add a config setting to ServiceDefinition.csdef called “DeployStackify”, ie.

    <Setting name="DeployStackify" />
</ConfigurationSettings><span id="mce_marker" data-mce-type="bookmark" data-mce-fragment="1">​</span>

2. Also add another variable to the startup task that reads from this setting, ie.

<Task commandLine="Install.cmd" executionContext="elevated" taskType="background">
        <Variable name="ACTIVATIONKEY">
            <RoleInstanceValue xpath="/RoleEnvironment/CurrentInstance/ConfigurationSettings/ConfigurationSetting
            [@name='SelfMonitorAgentActivationKey']/@value" />
        <Variable name="DOWNLOADURL">
            <RoleInstanceValue xpath="/RoleEnvironment/CurrentInstance/ConfigurationSettings/ConfigurationSetting
            [@name='SelfMonitorAgentDownloadPath']/@value" />
        <Variable name="DEPLOY">
            <RoleInstanceValue xpath="/RoleEnvironment/CurrentInstance/ConfigurationSettings/ConfigurationSetting
            [@name='DeployStackify']/@value" />

3. In each transform of the service config, provide the value for this setting, ie.

    <Setting name="DeployStackify" value="true"/>

4. In the Install.cmd file, read this variable and decide whether or not to install, ie.

if "%EMULATED%"=="true" goto :EOF
if "%DEPLOY%"=="false" goto :EOF
md "%~dp0appdata"
reg add "hku.defaultsoftwaremicrosoftwindowscurrentversionexploreruser shell folders" /v "Local AppData" /t REG_EXPAND_SZ /d "%~dp0appdata" /f
powershell -ExecutionPolicy Unrestricted .Install.ps1 %DOWNLOADURL% %ACTIVATIONKEY%