Azure Functions CLI - such a pretty logo for such an awesome functionality

How to access EF’s DbContext in an Azure Function on V2 runtime?

This post describes how you can access your Entity Framework Core model classes and the database context in your Azure Functions. In my example I’m using EF Core 2.1, but the main principle should be the same for later versions as well. Please note, that I use Azure functions runtime 2.x (and so should you!) Another easy one, that I was unable to find much guidance on! But first, let’s start with the basics. Why would you want to have this setup? Why would you […]

Azure Functions CLI - such a pretty logo for such an awesome functionality

Sudden “Function compilation error” for an Azure Function

Welp – another interesting error encountered while deploying Azure Functions to Azure. So, everything runs nicely locally, but when you deploy your well-tested, functional and pretty code to run them in the cloud, you’ll just get these ugly and unfriendly errors. Long story short, “Function compilation error” is what you’re faced with. Example error below: Function compilation error Microsoft.CodeAnalysis.Scripting.CompilationErrorException : Script compilation failed. at async Microsoft.Azure.WebJobs.Script.Description.DotNetFunctionInvoker.CreateFunctionTarget(CancellationToken cancellationToken) at C:\azure-webjobs-sdk-script\src\WebJobs.Script\Description\DotNet\DotNetFunctionInvoker.cs : 314 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.Azure.WebJobs.Script.Description.FunctionLoader`1.GetFunctionTargetAsync[T](Int32 attemptCount) at C:\azure-webjobs-sdk-script\src\WebJobs.Script\Description\FunctionLoader.cs : 55 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async […]

Low-code / no-code basically means serverless

How to remove Azure Functions without deleting the Functions App?

Have you ever run into a situation, where you just wanted to remove the currently standing function definitions from your app service without actually nuking the whole Functions app? I have! App Service configuration is usually easy to manage programmatically or by scripting, so even if you need to redo the deployment, it should be fairly straightforward. But what if you don’t have the setup scripted, and have already configured everything the way you like it – you’d really like to NOT nuke the whole […]

Get-Command -Module AzureRM.Profile. You're seeing it correctly - it doesn't have a Logout-AzureRmAccount, Disconnect-AzureRmAccount, Remove-AzureRmAccount or even Remove-AzureRmContext commandlets! That's a lot of fun :)

Oh no! PowerShell cached my Azure credentials and I messed up wrong customer’s environment!

Whoops. Could happen to anyone, since the Azure PowerShell since (approximately) version 6.3.0 will cache your credentials between sessions without warning you. It’s really easy to run your commands with cached accounts, and end up executing your scripts against the wrong environment. In less serious cases, this means that you’ll end up running commandlets twice against the test environment, while you think you’re running them first against test, and then production. In more serious cases, you’ll deploy your ARM templates or run your cleanup scripts against wrong […]

SOLVE ALL THE ERRORS!

Azure Functions failing on “OPTIONS” call? Quick fix!

I recently ran into an issue when developing Azure Functions locally. My SPFx webpart was configured to request information from my locally running Azure Function, but suddenly started ending up in error. Browser only showed 404 for the first request (OPTIONS) the SPFx webpart was sending – although I knew the function was up and running! So what to do? Posts Related to “Azure Functions failing on “OPTIONS” call? Quick fix!”:The Scary Anatomy of a Microsoft License FraudWhat is “fp.js” – and why is it […]

Azure Functions CLI - such a pretty logo for such an awesome functionality

Ignite 2018 recap: What’s new for Azure Functions?

Ignite 2018 is done and dusted, and it’s a good time to quickly recap what’s new for Azure Functions in the coming months. They’ve certainly been getting a lot of love from Microsoft, which is GREAT! New features for Azure Functions There was a bunch of exciting new things announced! Not all of the things in this blog post are necessarily completely new – but rather reached General Availability. Let’s go through them one by one… Posts Related to “Ignite 2018 recap: What’s new for […]

The following functions are in error... And that's about it.

Fixing “The following functions are in error: Object reference not set to an instance of an object.” error in Azure Functions

Let me start this article, by reminding everyone that Azure Functions are awesome, and you should use them despite some hiccups. Having said that, let’s fix some errors! In the beginning of September 2018, Microsoft started pushing out breaking changes to Azure Functions 2.x. They had announced this a full month in advance, so they expected everyone in the world to update their Azure Functions to avoid the functions from breaking. I guess, however, that in real life, a month is not that much. Me, […]

Azure Functions SDK 2.0 settings in accessed in C# code

How to access Azure Function App’s settings from C#?

This post describes, how you can access the function’s Application/Environmental settings/variables from your C# code. Different versions of Azure Functions have different ways to access the Azure Function settings. This has been another little thing, that I always forget – so better document it somewhere! How to get application settings in different runtime versions of Azure Functions? This has changed between different versions of Azure Functions runtime – so I’m describing what works for your functions using v1 runtime, what works for v2, and of […]

Azure Active Directory (Azure AD)

Fixing issue “AADSTS70005” by enabling the implicit authentication flow for your Azure AD app

Another day, another Azure Active Directory error! So what’s this AADSTS70005 all about? While either developing or just trying to use an application that authenticates against Azure AD, you might get an error message that contains error code “AADSTS70005“. This means that you’re trying to use implicit authentication flow, but it isn’t allowed for your app. If you have access to the Azure AD you’re authentication against, it’s easy to fix! See more below… Reason You might get an error, somewhat like this: AADSTS70005: response_type ‘token’ […]

"Publishing Failed" for an Azure Function

Fixing the error “Web Deploy cannot modify the file on the Destination because it is locked by an external process.”

This post describes how to fix the error, where when publishing Azure Functions or Azure App Services you get an error like this: “Web Deploy cannot modify the file on the Destination because it is locked by an external process.” This is luckily another straightforward fix!  Problem Azure Function Publish fails with a message: “Web Deploy cannot modify the file on the Destination because it is locked by an external process.” It is, indeed, caused by some of your files at the target of your publishing being […]

AADSTS50011: The reply address ... does not match the reply addresses configured for the application.

How to fix AADSTS50011: Reply address did not match because of case sensitivity.

So, you got an error with a code AADSTS50011? It’s just Azure AD’s authentication acting up because of invalid reply address! here’s a bunch of different reasons that lead to this error. This post describes the variant where the URL’s case sensitivity differns from what’s configured. For me, the most typical scenario where I run into this error is accessing the app from SharePoint. Problem So, you’re getting an error somewhat like this: AADSTS50011: The reply address <…> does not match the reply addresses configured […]

"The resource you are looking for has been removed, had its name changed, or is temporarily unavailable." leads to a 404 error in jQuery.

How to fix an Azure Function (v2) failing with error “The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.”

This post describes one way to resolve a problem, where you receive an error like “The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.” when calling your Azure Functions. Problem Another day, another simple, yet kind of weird issue to solve! This time I was developing a simple Azure Function to access Microsoft Graph API. This particular issue was kind of bugging, since the error message actually had nothing to do with the actual issue and gave […]

Obama congratulates you on your broken apps

Fixing an unhandled exception about StructureMap configuration failing (messed up assembly bindings)

So, you’re running a console program, but while you try running it, you get an error like this: “StructureMap.Exceptions.StructureMapConfigurationException”, with a message like this: “Unable to find the exported Type’s in assembly” (the typo done by Microsoft, not me). There’s a number of reasons for this error, but for a fair share of the time that’s just your assembly bindings being messed up. Luckily, that’s another easy fix!  Posts Related to “Fixing an unhandled exception about StructureMap configuration failing (messed up assembly bindings)”:Getting Connect-MsolService (and […]

Microsoft Azure logo

Solving Azure Web Application’s first load perfomance issues

Is your Azure Web Application suffering from absolutely horrible load times every time someone accesses it for the first time every 15 minutes or so? Mine was. It was pitiful. I was developing a web-based service using EF6 and ASP.NET MVC 5, where all the assets were hosted in the Azure. Even though the app was reasonably lightweight and usually responded very fast, the first time someone accessed it in a while it took 20-60 seconds to load AND sometimes even timed out (especially with […]

Won my first hackathon!

Hackathon win: Resolving Managed Metadata Madness

I won a hackathon! They had fun topics, it was a cool challenge, a well organized event, and had cool prizes. Since this is the first hackathon I ever took part in, I thought I’d post something about my experience and the solution(s) I figured out. Posts Related to “Hackathon win: Resolving Managed Metadata Madness”:SharePoint-Teams -integration using a tabThe Scary Anatomy of a Microsoft License FraudA cautionary tale of relying on the automatic backups in SharePoint Online

AADSTS90013: Invalid input received from the user. (header thumbnail)

Solving error “AADSTS90013: Invalid input received from the user”

I stumbled upon a customer, that complained about some pages in their intranet throwing weird errors with authentication. Those pages seemed to have one thing in common – there was a Yammer embed (or a SharePoint script webpart with Yammer embed script in it, to be precise) there. The error code they got was “AADSTS90013: Invalid input received from the user”. Below, you can see an example of the error screen. Okay – this is going to be extremely specific, and probably won’t solve the […]

Call to sites Graph API requires “owner” permissions for site collection regardless of app permissions

Okay – yet another weird issue, and a hacky workaround. I was developing an app that was calling a SharePoint site through Graph API, using jQuery $.ajax call (developed in TypeScript), and ran into surprising 401 errors. I did find a workaround, but am also working on an actual fix. Description To get SharePoint site ID, which is needed when accessing SharePoint lists, the calls seemed to fail for my test accounts. Everything was working fine for my developer account, which was a global admin, […]

Azure AD Login error

4 ways to fix error AADSTS65001 (The user or administrator has not consented to use the application)

Have you run into error AADSTS65001 with your application, that tries to authenticate against Azure AD? I sure have – seems to happen at least every other time when I’m building something that uses AAD to authenticate against SharePoint. Fixing issues with Azure AD authentication for Enterprise applications can be tricky. But a lot of the time, this is just another Azure Active Directory error that we can fix easily. This article contains multiple different solutions to the issue, where granting admin consent has somehow […]

Connect-MsolService

Getting Connect-MsolService (and other Azure Active Directory PowerShell cmdlets) to work

In this post, I’ll try to archive everything you need to download and install to get commandlets like Connect-MsolService working. I’ve had to do it a couple of times when changing laptops, so it’s good to document them somewhere! :) So, when would you need to follow this guide and install the modules described here? Mostly this comes to play, when you’re switching machines, try to run the SharePoint Online Management shell but it doesn’t even exist on the machine, or it does exist but […]

Applying Entity Framework’s Code-First Migrations against a Database in Azure by running Update-Database

This post describes how to run Entity Framework’s code-first migrations against a database located in the Windows Azure. This is done by running Update-Database commandlet with suitable switches, see below. The problem and symptoms Okay, so you’re developing your MVC+EF cool web app with a database in Azure, and you’re using code-first migrations. Cool! What’s nice with code-first-migrations is the fact they are run automatically even in the cloud the next time your app is running (as long as you publish your app with that […]

Entity Framework's Update-Database throwing an error

Fixing “An error occurred while updating the entries” while running code-first migrations in MVC 5 app

This post describes an issue with EF’s code-first migrations, when mapping between DB’s DateTime (datetime2) and C#’s DateTime simply fails, and results in the Update-Database cmdlet failing, too. It’s more or less a prime example of a situation, where the error itself tells very little about the actual issue, and since debugging code-first migrations is kind of difficult (see the best tips for that here!), it’s cumbersome to investigate. Symptoms So what’s the error that we’re running into, exactly? Below, you can find the most […]

Azure SQL Error

Fixing error “Cannot open server – – requested by the login. Client with IP address – – is not allowed to access the server.” in Azure deployments from Visual Studio

This article explains how to work your way around the exception ‘Cannot open server – requested by login…’ The issue is caused by Azure’s firewall logic, that might sometimes appear a little bit overzealous for simple development workloads, and might stop you from accessing your databases from your development machine. But just as everything else in Azure, the firewall exists for a reason, and working with it just requires a couple of extra clicks, is all. :) Symptoms Typically, you encounter this issue, when trying […]

Too long deployment path

Fixing error: “The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.”

This post describes a few different ways of fixing the error “The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.” one can get encounter this issue at least when trying to package/publish a SharePoint solution, web site or an Azure Webjob. Symptoms Visual Studio throws the following error when packaging a SharePoint solution to a .wsp file, OR when deploying or publishing your […]