Reputation: 2741
How do I download the source code of already-deployed Azure functions? The person who deployed this function has not versioned it in a repo yet, and the button is grayed out in the portal, as you can see.
Upvotes: 4
Views: 8045
Reputation: 1483
What works:
unsquashfs $zipfile
squahsfs-root
mv sqhashfs-root $(basename $file .zip)
Upvotes: 4
Reputation: 30995
You can also use the REST API to download. First log into Azure, then go to one of these urls depending on how your app is configured:
https://<function_app>.scm.azurewebsites.net/api/zip/site/wwwroot/
https://<function_app>.scm.azurewebsites.net/api/zip/data/SitePackages/
Warning! This will zip and download everything in the specified folder. To see what is in the folder before you download, you can snoop around using Bash by going here:
https://<function_app>.scm.azurewebsites.net/DebugConsole
You can also get to this by clicking on "Advanced Tools" from within the Function App UI in Azure.
Upvotes: 4
Reputation: 91
Since this is still the top post when searching for this problem, I'll add what I found for Python functions:
Following Monika's instructions I was able to ftp into the machine, but the wwwroot folder only had a host.json file. Looking around a bit I found that the actual zip files with the function's code were in the /data/SitePackages/
directory. Each file's name is a 14 digit number representing the upload date and time (yyyyMMddHHmmss
). After unzipping the file I finally had access to the function's source code.
Upvotes: 3
Reputation: 963
You can download the app content of azure function via FTP into App Service using "Get publish Profile" in the portal.
Then, you need to download the publish profile. Because publish profile contains all the credentials needed for you to FTP into the app service and download your source code. Click "Get Publish Profile" to download.
Once the publish profile is downloaded, open the note and extract the following content from the Note.
I hope this information helps.
Upvotes: 4