Reading a static variable in an Azure App Service

Visit the Kudu site

The URL for a Kudo site is normally just https://contoso-images.azurewebsites.net with scm put inbetween the host and the .azurewebsites.net bit.

So https://contoso-images.azurewebsites.net becomes https://contoso-images.scm.azurewebsites.net.

You can otherwise use the handy script below:

$name = "contoso-images"

$id = az webapp list --query "[?name=='$name'].id | [0]"
$url = az webapp show --id $id --query "hostNameSslStates[?hostType=='Repository'].name | [0]" --output tsv

Start-Process ("https://" + $url)
Script to start the Kudu Interface for 

Generate a full memory dump

Inside of Kudu's online interface, goto Debug Console -> Powershell via the menu at the top, then use the following script to generate a memory dump. The SysInternals tools are alreay installed on the machines by default.

$targetPID = (Get-Process | Sort-Object -Property "StartTime" | Select-Object -First 1).ID

& "D:\devtools\sysinternals\procdump" -accepteula -ma $targetPID

It will take a little bit to dump the memory to a local file. Which you can then download by clicking the icon circled below:

Kudu Interface showing the dump with the download button (circled).

Download all the code

Using the same window as above, click on site, then click on the download button next to wwwroot.

Kudu Interface showing the site directory with the download button (circled).

This will download a ZIP of the code running on the site.

Use dotPeek to decompile the C# Project

Install dotPeek however you like, then start it up and follow these steps:

Add the files downloaded from Kudu to dotPeek .

Start the Symbol Server

Start the Symbol Server using the button shown below:

Open the memory dump and set the symbol server

Open the memory dump in Visual Studio. Use the option Set symbol paths to open the Options menu, then the + to add the dotPeek url http://localhost:33417 to the studio.

Start Debug with Managed Only

Use the button top-right Debug with Managed Only, which'll start-up the debug instance. This will look like you've hit a breakpoint, but without any code showing.

Swap thread to... something

Honestly I have no idea what this is for. But go to Debug -> Threads, then pick any thread that has text next to it.

Use the immediate window to show the static variable

Open the Debug -> Immediate Window, then, in the new Immediate Window type the full name of the static variable you'd like to read.