Running Azure Functions locally with .NET Aspire + Azurite

You can orchestrate an Azure Function right inside .NET Aspire, complete with a local Azurite storage emulator and a single place (the Aspire dashboard) to observe everything. This post walks through a minimal setup using the isolated worker model on .NET 9.

What we’ll build

  • A simple HTTP-triggered Azure Function (/api/Hello)
  • An Azurite container for Storage (Blob/Queue/Table)
  • An Aspire AppHost that:
    • starts Azurite,
    • wires the Function’s AzureWebJobsStorage,
    • exposes the Function on port 7071

Create the project

# Templates
dotnet new install Microsoft.Azure.Functions.Worker.ProjectTemplates
dotnet new func -n AzureFunction -F net9.0

dotnet new install Microsoft.Azure.Functions.Worker.ItemTemplates
dotnet new http -n Hello -A Anonymous -p:n AzureFunction

# Aspire orchestration
dotnet new aspire-apphost -n AppHost
dotnet new aspire-servicedefaults -n ServiceDefaults

# (macOS) Core Tools for local runs
brew tap azure/functions
brew install azure-functions-core-tools@4
echo 'export PATH="/opt/homebrew/opt/azure-functions-core-tools@4/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

func --version

Folder layout

09_AzureFunction/
├─ AppHost/
├─ ServiceDefaults/
├─ AzureFunction.csproj
├─ Program.cs
├─ Hello.cs
├─ host.json
├─ local.settings.json
└─ README.md
Continue reading “Running Azure Functions locally with .NET Aspire + Azurite”

Web/Site Templates in SharePoint Online Modern Pages? No problem.

Let’s imagine that we want to have site template with predefined design, sections, web parts on it, lists with additional fields, custom page settings etc. etc.

If you are familiar with SharePoint On-Prem versions there we have Site Definitions and Web Templates for stuff like this. But what can we do now in SharePoint Modern Sites times in a combination with SharePoint Online?

We have to learn something new – there we have Site Scripts and Site Designs for some specific common steps in creation process of our Web/Site Templates. What you could do with Site Scripts you could see on that link.
But scope of modifying with Site Scripts is a lil’bit small, so we have to take a look into alternatives.

In SharePoint world we have SharePoint PowerShell modules – so we could use PowerShell to modify our Modern Pages in SharePoint Online. But we want to make this happen automatically when new Web/Site was created -> so we want to make this happen with Web/Site Template.
That is possible only with Site Scripts and Site Designs. Fortunately we could connect our PowerShell scripts with Site Scripts and Site Designs via Microsoft Flow, which could call Azure Function App which contains PowerShell script.

But PnP team go further with PnP Provisioning Engine in their PnP PowerShell modules where you could easly specify Web/Site Template in one XML file and put it into your PowerShell script which is called from Site Scripts via Flow.

Let’s take a look into a simple example.

Continue reading “Web/Site Templates in SharePoint Online Modern Pages? No problem.”

Import PowerShell Module / Package into your Azure Function App

If you have a concern about how you could use external PowerShell Modules or Packages inside of you Azure Function App written in PowerShell language then you could read this blog post where I want to show you my solution for that.

First of all you have to know that if you want to write Azure Function with PowerShell language support, then you have to use Function App with Runtime version 1.0 – so you couldn’t use latest runtime version 2.0 because there is no support for PowerShell language.

But why use PowerShell in Azure Function App? Let’s imagine scenario that we want to connect to Skype For Business Online API to which you could connect only from PowerShell.

But in that case we have to import specific PowerShell Module or Package into Function App in Azure.
You cannot simply call Import-Module SkypeOnlineConnector like on your local machine where you have previously installed SkypeOnlineConnector from that site. But you have to copy all files from that locally installed package into specific folder inside of your Function App in Azure.

So let’s take a look how you could do that.

Continue reading “Import PowerShell Module / Package into your Azure Function App”

Website Powered by WordPress.com.

Up ↑