Arm template for Azure Function with slots and restricted storage account

382 Views Asked by At

I have an azure premium function which I want deployed to a storage account which is protected via vnet. I have followed this guide: https://learn.microsoft.com/en-us/azure/azure-functions/configure-networking-how-to#restrict-your-storage-account-to-a-virtual-network and it works fine.

I now want to add slots to the template to allow me to hot swap the deployment in live

If I deploy the arm template with slots added (but no configuration specified for the slot at all, so it should get all the app settings from production) I can see it's changed WEBSITE_CONTENTSHARE in the staging slot by adding 2452965d as shown below:

enter image description here

I can't actually deploy to the slot now without manually creating the share ***-dev-2452965d in the storage account (previously to deploy without a slot I needed to create the share ***-dev so this isn't a surprise.

It will then correctly deploy the app to the slot.

Where things fail now is trying to swap the deployment. Clicking swap in the portal gives this error:-

Failed to complete swap between slot 'staging' and slot 'production'. Error: {"_body":"{"Code":"InternalServerError","Message":"There was an unexpected error swapping slots 'staging' and 'production' for site '***-dev(staging)'. Please try to cancel your swap operation

I'm guessing this error is because the storage account is behind a vnet and I still need to manually create the shares or manipulate them in someway but can't. I'm at a loss if there is a way to make this work.

1

There are 1 best solutions below

0
On

I asked Microsoft this:

So can you confirm that premium functions using storage secured behind a vnet do not support slots. I just can’t find this documented anywhere.

And they replied with:

Hello Ross, I tried to get supportive documentation myself but couldn't get one yet. However, it does not support swapping if the storage account is behind VNet. My Best Regards,

So it's just not supported, nor documented anywhere sadly.