Categories
Azure Azure Functions

Using Azure Functions with Rider

Previously we’ve written about how to get started with Azure Functions using JetBrains Rider – but that’s now an outdated article, as the Azure plugin now offers seamless integration with the Microsoft Functions tooling. Gone are the days of manually updating project configuration files.

What you’ll need

In order to follow along, you’ll need to make sure you:

Getting started

First you’ll want to install the Azure Toolkit for Rider. Open Rider then navigate to Preferences (JetBrains Rider > Preferences on a Mac) and Plugins.

In the Plugins screen, go to the Marketplace tab ¬†and search for “Azure Toolkit for Rider”. Click install.

This will now allow you to manage and deploy a whole bunch of Azure services from within Rider, such as App Services and SQL databases.

Let’s open a new Functions app. Now that you’ve installed the Azure Toolkit, a new template for AzureFunctions has been added to your new project window. From within Rider, click File > New and choose Azure Functions from underneath the .NET Core section.

Enter a solution name, project name and choose a directory and language, and then click Create. If you’re using this as a test project, you can probably leave these values as is.

Running the Functions app

And that’s almost all there is to using Functions apps in Rider now! The toolkit will automatically detect that it’s a function app, and provide the necessary scaffolding to allow you to run and debug the app.

Gone are the days of hacking the project settings and configuration to make it work – it’s a seamless experience now.

To verify that the config is correct, click the run configuration in the top right-hand side of Rider, and edit the configurations. You should see a default Azure Functions host configuration, complete with all the settings required to run a functions app. You can see in this example that the function will run on port 7071, and pause on error.

Even better, is that if you don’t have the required Functions command line tools to run the app (which Rider relies on behind the scenes) then you’ll even get prompted to install them – which Rider will do automatically on your behalf. You’ll also get prompted if your tools are out of date.

And that’s how easy it is now to get started using Azure Functions in Rider!

Categories
Azure Azure Functions

Building Azure Functions in the Rider IDE

Many people now use Rider as their integrated development environment editor for .NET. However, when it comes to using it for developing Azure Functions, the out-of-the-box experience is (currently) less than ideal.

I say currently, because in the next update to the Azure Toolkit plugin for Rider Functions support has been added. This’ll make running and debugging function apps a breeze.

Until then though, here’s how you can run a functions app from Rider.

How to run Azure functions in Rider

First, you’ll need to install the function CLI (see creating an Azure function for the Mac).

Then, open your functions app in Rider by selecting the project or solution.

Create a Properties folder in the root directory if you don’t have one already, and then inside of that create a new JSON file called launchSettings.json.

Inside the JSON file, place the following object:

{  "profiles": {    "functions": {      "commandName": "Executable",      "executablePath": "func",      "commandLineArgs": "start --port 7071 --pause-on-error"    }  }}

You should see Rider now refresh, and add the configuration profile to your configurations with a little rocket icon. Click run, and your function app should start running within Rider.

Note that debugging is a little tricker for now. On Windows, once your function app is running you can go “Run” > “Attach to process” and choose your function app to listen to. But on a Mac, this has had mixed results.