This is the continuation of my previous article – Create and Debug Azure Function using Visual Studio 2017 – Part 1 in this article we will concentrate more on publishing azure function which we created in previous article and how to handle it from azure portal.
Step 1: Still our Azure function (which we created in previous article) is available in local and to publish into Azure, right click on the project and click on Publish.
Step 2: It automatically connects to your Azure account (if not, Sign In using your azure account from Server Explorer or Cloud Explorer available under View option in menu bar) and it asks for Azure App Service to publish your azure function. In my case I already created my Azure App service; you can create new app service if required.
Consider Function App Service as a parent of Azure function. We can have multiple azure functions inside app service and it shares the configuration.
When we create azure function from the portal then this will be the first step. We need to create at least one Azure App Service before creating Azure Function.
Step 3: Before we publish from VS, it is better to check on one of the important option called “Remove additional files at destination”. This is checked by default and this will delete existing files before publishing your function which is created in VS.
If you don’t want to delete existing functions in your Azure App Service then please uncheck this option before publishing.
And click on Publish, make sure you are connected to Azure in your VS, you can easily check by going to Server Explorer window.
Step 4: Once it’s published, we can see the published Function in our Azure Portal. And it will be in read only mode.
Step 5: Now it’s easy to test your function because it gives you real URL and no need to depend on localhost anymore.
After publish from VS, app will become read-only mode. To overcome this, go to Function app settings
In Function app settings window, change the mode from Read Only to Read/Write mode.
It will make your function read/write. If we create Azure Function from the portal it’s easy to integrate and we can change the integration (Input, Output) through UI.
I hope this article is helpful to understand How to work on Azure Function from VS2017. Thank you for reading.