Deploy the Agent in Azure Environment
Agent v2.3 and above
- Add the following to the WebRole project and set their "Copy to Output" property to "Copy Always".
a. .NET agent Installer (apminsight-dotnetagent.msi),
b. The "apminsight.conf" file, containing license key and other configuration options, and,
c. The batch file, "deploy-apminsight.cmd".
-
Add a startup task in the service definition (.csdef) file as follows :
<ServiceDefinition>
<WebRole>
<Startup>
<Task commandLine="deploy-apminsight.cmd configfile=apminsight.conf
appfilterconfigfile=appfilter.conf multimonitor=true/false"
executionContext="elevated" taskType="background"/>
</Startup>
</WebRole>
</ServiceDefinition>
Agent below v2.3
- Add the following to the WebRole project and set their "Copy to Output" property to "Copy Always".
a. .NET agent Installer (apminsight-dotnetagent-x64.msi or apminsight-dotnetagent-x86.msi),
b. The "apminsight.conf" file, containing license key and other configuration options, and,
c. The batch file, "deploy-apminsight-x64.cmd" (or deploy-apminsight-x86.cmd).
-
Add a startup task in the service definition (.csdef) file as follows :
<ServiceDefinition>
<WebRole>
<Startup>
<Task commandLine="deploy-apminsight-x64.cmd configfile=apminsight.conf
appfilterconfigfile=appfilter.conf multimonitor=true/false"
executionContext="elevated" taskType="background"/>
</Startup>
</WebRole>
</ServiceDefinition>
Monitor Select Applications Using Application Filters
Add the parameter appfilterconfigfile=appfilter.conf to monitor only select applications (as mentioned in the commandline task). This should contain the App Filter related configurations (include.app.names and use.appfilter). Follow the steps here to configure app filters manually. It is recommended to do this configuration via UI in an identical setup and copy the config file if possible.
To deploy:
- You can publish the cloud service from Visual Studio itself or
- Bundle it into a package and upload the package in your Azure Portal from your CloudService (Update).
Known Issues and Workarounds
In Azure machines, the "W3SVC" service (World Wide Web Publishing Service) has its startup type as "Manual" by default. This might cause a "Service Unavailable" issue when visiting websites after .NET agent is installed (IIS reset happens during installation). Set this startup type to "Automatic" to workaround this issue. This can be achieved by adding the following line in the batch file before the installation command, sc config w3svc start= auto.
Agent v2.3 and above
Copy and paste the below script in a new text file and name it as deploy-apminsight.cmd.
deploy-apminsight.cmd
REM Install the ApmInsight agent on Windows Azure
SETLOCAL EnableExtensions
REM Bypass the installation if already installed
IF DEFINED COR_PROFILER GOTO :END
IF NOT EXIST apminsight-dotnetagent.msi GOTO :END
REM set the w3svc IIS worker process startup service to auto
sc config w3svc start= auto
REM Install the agent
apminsight-dotnetagent.msi /quiet /log %windir%\ApmInsightInstall.log editconfig=false %*
:END
EXIT /B %ERRORLEVEL%
Agent below v2.3
Copy and paste the below script in a new text file and name it as deploy-apminsight-x64.cmd. For an x86 agent create a similar script with the x86 msi file name.
deploy-apminsight-x64.cmd
REM Install the ApmInsight agent on Windows Azure
SETLOCAL EnableExtensions
REM Bypass the installation if already installed
IF DEFINED COR_PROFILER GOTO :END
IF NOT EXIST apminsight-dotnetagent-x64.msi GOTO :END
REM set the w3svc IIS worker process startup service to auto
sc config w3svc start= auto
REM Install the agent
apminsight-dotnetagent-x64.msi /quiet /log %windir%\ApmInsightInstall.log editconfig=false %*
:END
EXIT /B %ERRORLEVEL%