Skip to content

Instantly share code, notes, and snippets.

@faloi
Created June 2, 2014 22:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save faloi/837b5ff79a9a0b7868a9 to your computer and use it in GitHub Desktop.
Save faloi/837b5ff79a9a0b7868a9 to your computer and use it in GitHub Desktop.
A workaround to force New Relic to release the DLL on an Azure Website
# AUTHOR:
# @faloi - Federico Aloi
# PURPOSE:
# A workaround to force New Relic to release the DLL on an Azure Website, accomplished by toggling profiling on/off.
# This script must be run before and after the actual deploy, assuming that profiling is enabled at the beginning.
# PRECONDITIONS:
# $azureWebsiteName is an existing Website of the current subscription
# COR_ENABLE_PROFILING is an existent app setting
Param(
$azureWebsiteName = ""
)
function setSettings($appSettings, $key, $value) {
$appSettings[$key] = $value
}
function toggleProfiling($appSettings) {
$PROFILING_SETTING = "COR_ENABLE_PROFILING"
$isProfilingEnabled = $appSettings[$PROFILING_SETTING]
if ($isProfilingEnabled -eq "1") {
Write-Verbose "Disabling profiling..."
setSettings $appSettings $PROFILING_SETTING "0"
} else {
Write-Verbose "Enabling profiling..."
setSettings $appSettings $PROFILING_SETTING "1"
}
}
$site = Get-AzureWebsite -Name $azureWebsiteName
$appSettings = $site.AppSettings
toggleProfiling $appSettings
Set-AzureWebsite -Name $azureWebsiteName -AppSettings $appSettings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment