1

I had developed azure function solution in Visual Studio 2019 and deployed to azure function by downloading publisher .

But accidently I had deleted entire source code in local machine where I could not get even from "recovery software tools" also.

is there any way can I get source code files from azure function development tools in azure portal? or local machine C drive?

PavanKumar GVVS
  • 859
  • 14
  • 45

3 Answers3

1

If you open up the Azure Function App Service and navigate to the "Functions" section you will be able to open your individual functions and then select the "Code + Test" section and be able to see your function

I don't know if the type of Function you developed impacts your ability to see this source code or not.

Connor Dickson
  • 770
  • 3
  • 12
  • This does not work. Since they deployed through VS, only the compiled DLLs are uploaded, not the actual sources – silent Dec 22 '20 at 10:24
  • Ah you might be out of luck because I can see my source code in that area. You could try opening the Kudu console under advanced tools in the App Service and then selecting the WebJobs dashboard from the Tools dropdown at the top and once in the WebJobs dashboard selecting functions at the top. But by the sounds of it if you found the compiled DLL I don't imagine the source code was uploaded as well. You could always decompile your DLL using dotpeek and see where that gets you? – Connor Dickson Dec 22 '20 at 10:45
  • I have just seen your comment above silent. If you have the DLL downloaded you can use [dotPeek by JetBrains](https://www.jetbrains.com/decompiler/) to decompile it and see your source code. Though the variable/method names could be different – Connor Dickson Dec 22 '20 at 10:55
  • Worked for me. I'm using vscode to develop and deploy Python functions and I also lost one of the functions. Checking "code+test" I can see my code and retrieve it. – Filipe Jun 03 '22 at 17:42
0

When you deployed through Visual Studio, the source was compiled locally and only the DLLs were uploaded. Thus, you cannot directly see your code. However, you can get to your DLLs and download those. Then you should be able to use any decompiler to see your source code again (maybe not as pretty as originally...).

Go to the SCM console to see and download all files: https://{YOURFUNCTIONNAME}.scm.azurewebsites.net/dev/wwwroot/

silent
  • 14,494
  • 4
  • 46
  • 86
  • Yes @Silent, I am able to get that DLL, but I added that DLL to project reference(console application) assuming if I hit F11 in debug mode, it may take me to source code. But its not happening. – PavanKumar GVVS Dec 22 '20 at 10:48
  • I said you very probably need a proper decompiler like ILspy – silent Dec 22 '20 at 10:53
0

I too did the same mistake that pavankumar gvvs did, I lost my source code. Now I need to find it from the function app hosted on my azure. And I did it now :)

2 steps :

  1. Locate the DLL

    a. Go to https://{YOURFUNCTIONNAME}.scm.azurewebsites.net/dev/wwwroot/

    b. Open the Kudu Console

    enter image description here

    c. The kudu console lists all your files that's deployed on the function app, see the dll and download it.

  2. View complete source code - use dotpeek

Cheers,

Rakesh

Rakesh
  • 97
  • 8