question

MattSchuerman-9200 avatar image
0 Votes"
MattSchuerman-9200 asked ·

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

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
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

MayankBargali-MSFT avatar image
0 Votes"
MayankBargali-MSFT answered ·

Hi @MattSchuerman-9200

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.

· 2 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hey @MayankBargali-MSFT , I think Matt's question is more whether it would be possible to reference the Azure function package from a zip file located relative to the arm template. We are generating a VSTS drop that contains the ARM template and the azure function package. So, would it be possible to reference the package like this?

"packageUri": "./../azFunFolder/pack.zip"

0 Votes 0 ·

Hi @DavidGaspard-2139 ·

Thanks for the clarification. I have updated my answer.

0 Votes 0 ·