I really like working with Azure functions in the portal but am starting to need some more tooling that I'm used to for committing to my git repo, easily adding assemblies, and just plain working in a more familiar environment.
Is it possible to create your Azure function app and possibly the functions themselves in the portal and then move over to Visual Studio and import that function app as a project? Or am I approaching this wrong? I understand we can create straight from Visual Studio and then publish up to Azure and maybe that is the way we should be doing it in the first place.
A few pieces you could do. You can start development in the portal and then download the app settings (connection strings, etc.) via the azure-function-core-tools with a CLI command like func azure functionapp fetch-app-settings <appName> - but that will just pull the settings into an existing local project.
You could also go to the Platform Settings tab and open the App Service Editor which would let you download the workspace as pictured below. That will download the function project into a folder you could check into source control and use with CI/CD.
However one important note is the portal for C# projects use C# script files (.csx), and the Visual Studio tools for Functions create .NET assemblies (.dll), so if using C# you wouldn't be able to download the workspace and open it up in Visual Studio - you'd likely be better off just copy/pasting the code into a Visual Studio project.
Personally since the latest v3 update of VS 2017 I find starting in Visual Studio is even more convenient than the portal was for Function apps.
Related
I notice (beginner) that when I generate a new .net web app in Visual Studio, it collects required packages from the web. I believe I need to connected to the web in order to create an app. Is there an offline mode where it stores the files needed?
When you create a new project, Visual studio will download the require NuGet packages (=dependencies) from the internet.
Technically you can add a local NuGet repository (=on your hard drive) but do you really want to do that?!
I found this article describing how to achieve that src
Is it possible to reference a c# class library in an Azure Function visual studio project?
I am aware of the possibilities to reference external libraries and Nuget packages.
Currently I am using shared .csx files as described here. These .csx files now contain a copy of my DTO's which are also used in the Service Agents which I use to consume the functions.
Ideally I want to add a reference in Visual Studio from a Function to a class library project and that Visual Studio is adding this dll to the bin folder.
Currently, project references are not supported, but you can have the output of your project (the resulting assembly and possible dependencies) copied onto a folder under your function's root, which you can then leverage using the external libraries support you've mentioned above (e.g. #r "..\myassemblyfolder\MyAssembly.dll")
If possible, I'd suggest opening an issue with that feature request, sharing more about your scenario on this repository. This allows other people to upvote those requests and helps the team prioritize this work.
Previously this was not possible. This is now possible as you can read here: https://learn.microsoft.com/en-us/azure/azure-functions/functions-dotnet-class-library.
Old answer:
This is now possible by using the new Visual Studio 2017 Tools for Azure Functions.
You can get more information about this in the following links:
Visual Studio 2017 Tools for Azure Functions
Azure Functions Visual Studio Tooling video
I primarily use Visual Studio, C#, and WebApi for my projects. We're looking to utilizing Ember, Ember relies heavily on Node Package Manager. Which Visual Studio does support, but is there a way to integrate Ember and their Command Line better into Visual Studio?
Currently, we would use Node and Ember for our frontend, then we would open Visual Studio and our backend code. They're currently separated, was hoping to avoid having to switch a better integration.
I have also tried myself and at the current time there are no usable plugins that help integrate ember into VS. You may use VS editor to modify the source but you wont get a lot of the build tools and extra features of VS.
I'm in the same scenario, WebApi backend + Ember client. Currently I add de ember app folder in the visual studio solution as "Existing Web Site", hide node_modules and temp windows folders and run all commands from external command line.
Thanks for looking.
I have a need to be able to create new Azure website and database instances from a Windows forms application I have created as an internal-use tool.
I am not sure if there is a C# API for this or if I need to use Powershell or some other CLI, but I would appreciate any advice.
All of the searching I have done on the subject has not turned up a simple, direct explanation as to how to do this or if it is even possible.
Using Azure Resource Manager (ARM) API's is the way to go these days - especially with your scenario. You've probably seen documentation that uses the old Service Management API's to do this. You could still do this, but I would strongly discourage it. ARM is where the investment in automation is landing going forward.
For your particular scenario, there is actually a tutorial here.
If you are using Visual Studio 2013 or 2015, then you can also use the ARM templates that it provides. For example, from Visual Studio, select File > New > Project and choose the Azure Resource Group project template.
The next window in the new project dialog is where you can select from some common deployment templates, such as what you are looking for, which is a Web App + SQL Database.
This project will contain the ARM template that describes your environment and a script that you can use to invoke ARM to deploy it.
To deploy the environment, right-click on the project in Visual Studio and select Deploy. Fill in the parameters that the template provides and you are on your way. If you look in the script that is generated (Deploy-AzureResourceGroup.ps1), you will see at the bottom of the script a call to New-AzureResourceGroup. What this does is basically merge your ARM template and parameters together and then sends them to Azure Resource Manager to provision the environment. In other words, you have everything here to automate this without having to do it from Visual Studio.
I would like to use GIT as version control on a Visual Studio 2013 project. It does however require you to create a project with Visual Studio Online. Does this mean that a copy of my code will be stored somewhere, or is the purpose of creating this project only to be allow other users to be added so that you can collaborate?
You don't have to use Visual Studio Online to use code control in Visual Studio. You can create the .git and use an external tool (like command line or source safe), or you can use the internal tool.
I think that the Visual Studio community edition struggles to create a git repo without being bound to the Visual Studio Online, but once its created, it works fine with various http remotes (I have a project here which uses two remotes, one being VSO and one being our gitlab repo that we use).
Storing your code remotely (but secured) on one of the major sites can be a major benefit to you in the long run. It gets you into good habits of committing and pushing your source, even when you're working alone.
VSO is basically a cloud-based version of TFS - Microsoft's source control, build and task management system.
In order to use the system for source control purposes, you need to use the "Check In" functionality on the Solution in the VSO project before the cloud-based version is updated. The initial project in VSO will likely be empty.
You can use VSO for collaboration but you don't have to.