Created
June 2, 2014 22:41
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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