Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are Deployment Slots supported when deploying Azure Functions from Visual Studio Code?

I built a very simple Azure Function in Node.js using Visual Studio Code. I also created a new Function App from the Azure Portal and created a "Staging" deployment Slot. Now I want to deploy my function from Visual Studio Code to this existing Function App and Slot - I can't! I do not find the way to select the Slot, and any deployment will go straight into the default/Production slot.

Is this supported from VS Code? If not, is it possible to do it from VS 2017 (remember that this is a Node.js project) ?

Thanks in advance

Jose

like image 901
Jose Parra Avatar asked Nov 07 '22 04:11

Jose Parra


1 Answers

Azure function slot is a preview version. It seems not supported in VS code, after creating a slot in the portal, there will not be a slot option and will be an error in it, like the screenshot. If not, there is normal. May be it's a bug. When deploying, it happens like you mentioned.

enter image description here

In the VS 2017, it works fine, just create the profile and publish your function.

enter image description here

Update:

My function is C#. Currently there is no Node.js function template in VS, but you could create c# function and write the function file with node.js manually and publish to azure function slot.

You could create it like the screenshot below, and set Copy if newer for the function.json and index.js.

enter image description here

Check it in the portal.

enter image description here

like image 63
Joy Wang Avatar answered Nov 11 '22 15:11

Joy Wang