Can we deploy Azure Functions referencing a zip file with relative path?

Matt Schuerman 1 Reputation point
2021-03-09T21:51:57.45+00:00

We need to deploy Azure Functions using an ARM template. We're going to use a CI/CD system as well, so it seems like packaging the function's bits in a zip file would be the best way to go. But we have this restriction that we need to reference the zip file in a path relative to the ARM template file. Is that possible?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,335 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. MayankBargali-MSFT 68,986 Reputation points
    2021-03-10T03:57:13.26+00:00

    Hi @Matt Schuerman

    Welcome to Microsoft Q&A! Thanks for posting the question.

    You can refer to this. The article refers has link to sample ARM template. Once the Function App is created, you will see that the sample has used MS Deploy extension and set the packageUri parameter and you assign the value to your function app zip (deployed in a storage account or access over the internet). Once the function app resource is created the below ARM template will deploy the function app code on your depended resource.

     {  
              "apiVersion": "2014-06-01",  
              "name": "MSDeploy",  
              "type": "Extensions",  
              "dependsOn": [  
                "[concat('Microsoft.Web/Sites/', parameters('name'))]",  
              ],  
              "properties": {  
                "packageUri": "https://auxmktplceprod.blob.core.windows.net/packages/wordpress-4.2.4-IIS.zip",    
              }  
    }  
    

    Update:

    You cannot use the relative path as the ARM does not support stream content.

    Note: ARM does not support stream content; meaning, one cannot upload local content directly to WebApp via ARM. Instead, the content needs to be out-of-band upload to a service (such as Azure Storage) which subsequently allows access to http(s). Then, configure the packageUri with the content URL with ARM template.

    Reference: https://github.com/projectkudu/kudu/wiki/MSDeploy-VS.-ZipDeploy

    Feel free to get back to me if you need any assistance.