Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to download Azure Function (Python) .zip file?

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:

enter image description here

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.

enter image description here

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. enter image description here

  • FTPS option: No .zip file available. Only the host.json file. enter image description here

like image 293
ericOnline Avatar asked Jun 16 '26 23:06

ericOnline


2 Answers

Finally! Figured this out.

To download the .zip file of a deployed Python Azure Function:

  • Go to https://<function-app-name>.scm.azurewebsites.net/api/vfs/data/SitePackages/
  • The body will look something like:
[
    {
        "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"
    }
]
  • Go to the href URL shown with the latest mtime to download the file
  • Notice: The latest timestamp is lower in the list (at least for me)

Its documented here

like image 67
ericOnline Avatar answered Jun 18 '26 14:06

ericOnline


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).

enter image description here

like image 25
Kashyap Avatar answered Jun 18 '26 13:06

Kashyap



Donate For Us

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