The docs here (from 2018) say to click Download app content from the Portal to retrieve a .zip file of your Azure Function.
However, this option is grayed out for my Python function:

The doc goes on to provide an alternative method for retrieving a .zip file using REST API with the following url https://<function_app>.scm.azurewebsites.net/api/zip/site/wwwroot/.
Unfortunately, this downloads a download.zip file containing only the hosts.json file rather than the Function code and associated files.

So, how do I download my Python Function as a .zip file from either Azure Portal, REST API or the scm backend?
EDIT 1: Trying the two proposed solutions so far yield no results either.
AzureWebJobsStorage: No scm-deployments container available.

FTPS option: No .zip file available. Only the host.json file.

Finally! Figured this out.
To download the .zip file of a deployed Python Azure Function:
https://<function-app-name>.scm.azurewebsites.net/api/vfs/data/SitePackages/[
{
"name": "20210507210231.zip",
"size": 22920602,
"mtime": "2021-05-07T21:03:30.9505229+00:00",
"crtime": "2021-05-07T21:03:30.9505229+00:00",
"mime": "application/x-zip-compressed",
"href": "https://<function-app-name>.scm.azurewebsites.net/api/vfs/data/SitePackages/20210507210231.zip",
"path": "/home/data/SitePackages/20210507210231.zip"
},
{
"name": "20210512182244.zip",
"size": 91280954,
"mtime": "2021-05-12T18:22:46.4017597+00:00",
"crtime": "2021-05-12T18:22:46.4017597+00:00",
"mime": "application/x-zip-compressed",
"href": "https://<function-app-name>.scm.azurewebsites.net/api/vfs/data/SitePackages/20210512182244.zip",
"path": "/home/data/SitePackages/20210512182244.zip"
},
{
"name": "20210520163007.zip",
"size": 22248931,
"mtime": "2021-05-20T16:31:13.4771898+00:00",
"crtime": "2021-05-20T16:31:13.4771898+00:00",
"mime": "application/x-zip-compressed",
"href": "https://<function-app-name>.scm.azurewebsites.net/api/vfs/data/SitePackages/20210520163007.zip",
"path": "/home/data/SitePackages/20210520163007.zip"
},
{
"name": "packagename.txt",
"size": 18,
"mtime": "2021-05-20T16:31:20.8453653+00:00",
"crtime": "2021-05-20T16:31:20.8453653+00:00",
"mime": "text/plain",
"href": "https://<function-app-name>.scm.azurewebsites.net/api/vfs/data/SitePackages/packagename.txt",
"path": "/home/data/SitePackages/packagename.txt"
},
{
"name": "packagepath.txt",
"size": 23,
"mtime": "2021-05-12T18:22:46.5567703+00:00",
"crtime": "2021-05-12T18:22:46.5567703+00:00",
"mime": "text/plain",
"href": "https://<function-app-name>.scm.azurewebsites.net/api/vfs/data/SitePackages/packagepath.txt",
"path": "/home/data/SitePackages/packagepath.txt"
}
]
href URL shown with the latest mtime to download the fileIts documented here
If you have access to the Function's storage account then just download from scm-releases container.
You can find the account connection string in AzureWebJobsStorage parameter under Configuration in portal (App Settings).

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With