Azure Functions

PowerShell Azure Functions Concurrency

It’s been a while since I’ve developed any Azure Functions. There was a time, where I was knocking them out very regularly. Well this week whilst working on a new project I jumped back into PowerShell Azure Functions, and cloud being cloud they’ve moved on in recent times. PowerShell is now a supported language (with the release of PowerShell 7) which is awesome. Goodbye Experimental Language warnings. However I quickly ran into what appears to be a common(ish) issue on the Azure Functions Consumption Plan of PowerShell Azure Functions Concurrency.

Background

The particular scenario I had is;

  • an Azure Function App that contains three PowerShell Functions
  • these functions were often being executed simultaneously
  • under the Azure Function App Consumption Plan there is only a single CPU available
  • by default the FUNCTIONS_WORKER_PROCESS_COUNT application setting is 1 and the PSWorkerInProcConcurrencyUpperBound is also 1
  • the combination of these factors meant my functions were timing out

The Error and Symptoms

When I looked in the event logs, when concurrent requests were being made I was seeing timeouts and the following error.
“Azure PowerShell Function is queuing requests as there are no available runspaces”.

Azure PowerShell Function is queuing requests as there are no available runspaces

The Resolution

The resolution that worked for me after a lot of reading and understanding the profile of my Functions was to set;

  • FUNCTIONS_WORKER_PROCESS_COUNT = 4
  • PSWorkerInProcConcurrencyUpperBound = 4

These are Application Settings. You configure them on your Azure Function App. For more information on these settings refer to the documentation here. If you encounter this problem a configuration that works for you will depend on how many functions you have, how long they run for and the concurrency across them.

Azure PowerShell Function Concurrency Application Settings

Summary

If you are running multiple PowerShell Azure Functions in the same Azure Function App on the Consumption Plan there is a high chance you are going to run into an issue with PowerShell Azure Functions Concurrency. You will need to workout the profile of your functions and update the Functions_Worker_Process_Count and PSWorkerInProcConcurrencyUpperBound Application Configuration settings accordingly.

Darren Robinson

Bespoke learnings from a Microsoft Identity and Access Management Architect using lots of Microsoft Identity Manager, Azure Active Directory, PowerShell, SailPoint IdentityNow and Lithnet products and services.

Recent Posts

EntraPulse – Your AI-Powered Gateway to Microsoft Graph & Docs

Today, I’m super excited to finally announce the Beta release of EntraPulse Lite – a…

2 months ago

Lokka MCP Authentication Enhancements

I'm excited to share some significant authentication enhancements I've contributed to the Lokka MCP Server…

3 months ago

AI Inception: Building AI Solutions with AI for AI

Last month I had the pleasure of speaking at the Sydney event for Global Azure.…

3 months ago

A Have I Been Pwned MCP Server for Claude

Model Context Protocol (MCP) is a powerful framework that extends AI clients like Claude and…

5 months ago

Azure AI Developer Hackathon

I've just completed participating in the Azure AI Developer Hackathon that was looking to provide…

5 months ago

Dynamics 365 CE (Sales, CRM) IAM PowerShell Module

Updated: July 2025 v1.0.2 Fixes issue setting D365SalesGlobals enabling session management for D365 Sales API…

6 months ago

This website uses cookies.