Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open an existing azure function in visual studio?

I'm pretty new to Azure and using the portal, wrote an Azure Function. Now I would like to continue working on it using Visual Studio 2017. I can't seem to find a way to open/edit this existing function in Visual Studio though.

I'm sure I could create a new Azure Function in VS, copy code over, setup/connect to storage, etc. and deploy a new instance and delete the current instance, but would like to avoid that.

Ideally, was hoping there was some kind of open/connect to Azure account in VS, or maybe an "edit in VS" button in the portal, etc.

TIA!

like image 849
Hoss Avatar asked Nov 25 '17 21:11

Hoss


People also ask

How do I create an azure function in Visual Studio?

Create an Azure Functions project 1 From the Visual Studio menu, select File > New > Project. 2 In Create a new project, enter functions in the search box, choose the Azure Functions template, and then select Next. 3 In Configure your new project, enter a Project name for your project, and then select Create. ... More items...

How do I publish a Visual Studio Code project to Azure?

Visual Studio Code lets you publish your Functions project directly to Azure. In the process, you create a function app and related resources in your Azure subscription. The function app provides an execution context for your functions. The project is packaged and deployed to the new function app in your Azure subscription.

How do I get Azure portal function app code in Visual Studio?

In this post, we are going to walk through taking our portal created function and getting it downloaded where it can be edited in Visual Studio. From the Azure Portal select App Services. Next, select the Function App you want to get the code for.

How do I use Azure tools in Visual Studio Code?

In Visual Studio Code, open Extensions and search for azure functions, or select this link in Visual Studio Code: vscode:extension/ms-azuretools.vscode-azurefunctions. Select Install to install the extension for Visual Studio Code: After installation, select the Azure icon on the Activity bar.


1 Answers

Well, as close as you can get to that is to go to the portal, your Function App, then click Download app content button and ask for Visual Studio solution:

Download app content

With Visual studio project

This will give you a zip file with Functions, including csproj file.

The problem is that portal functions are C# scripts (csx files), and Visual Studio isn't great to work with them. When you create a new Function App in Visual Studio 2017, it will make a precompiled function project - a normal class library with cs files.

Unfortunately, there is no automated way to convert script functions to precompiled ones.

like image 68
Mikhail Shilkov Avatar answered Sep 21 '22 18:09

Mikhail Shilkov