Pulumi Azure Next-gen

Pulumi task on Azure DevOps fails with error “azureblob.OpenBucket: accountName is required”

This article explains how to fix one of the many issues you might face when configuring Pulumi deployments for your Azure DevOps Pipelines! The particular error you may run into was “azureblob.OpenBucket: accountName is required” – what a descriptive one, when there’s no accountName to be specified anywhere! But first – let’s get through the basics. Namely… “Pulumi?”, you ask – “What’s that?” Well, let me give you a 1-line response to that. One very long line, that is. But what was the error I…Continue reading Pulumi task on Azure DevOps fails with error “azureblob.OpenBucket: accountName is required”

Say "Dependency Injection" one more time I DARE YOU

How to inject EF Core DbContext in an Azure Function?

Ah, one more on the related topics of different configurations for your Azure Function apps. In this article, I’ll describe how you can configure the Entity Framework Core database context to be injected into your Azure Functions App. In my experience, this is a very typical and often-needed model to structure your Azure Functions, so while tooling and templates aren’t quite there, it’s worthwhile to document here. Solution I’ve posted before about how to instantiate a database context using DbContextOptionsBuilder – see a copy-pasteable example…Continue reading How to inject EF Core DbContext in an Azure Function?

Entity Framework - am I right?

“Conversion overflow” when reading numeric data from MS SQL database using Entity Framework

This article explains how to fix a weird situation where your .NET application utilizing Entity Framework or Entity Framework Core simply crashes without any way to recover or catch the Exception. You only get errors somewhere along the lines of “conversion overflow”. Ah – what a fun little issue! Problem So when you’re trying to instantiate an entity with a property of type decimal, you’ll get one of the 2 following exceptions with varying Call Stacks: Conversion overflow or: Arithmetic overflow error converting numeric to data type numeric…Continue reading “Conversion overflow” when reading numeric data from MS SQL database using Entity Framework

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

How to configure Azure Function’s startup?

Azure Functions use dependency injection, and that allows us to define all kinds of prebuilt or custom-built services as being available for our functions really easily. This is a really easy way to initialize scoped resources to be used in your different functions… But how do you actually configure them in an Azure Functions App? Problem Okay, a step back – there’s a bit of a problem that we need to resolve before we can proceed with the configuration. When you create a new Azure…Continue reading How to configure Azure Function’s startup?

SharePoint is not broken - it just does't work

(Literally) Breaking: Changes to app authentication on SharePoint! 😵

This article explains how to get rid of sudden and unexplainable 401 Access Denied errors when trying to authenticate against a fairly fresh Microsoft 365 / SharePoint Online tenant. This issue seems to be caused by a long-ish project to finally retire ACS – Azure Access Control service) on SharePoint (it’s retired everywhere else already!) Note: This is an updating story, as the situation with ACS is definitely… Developing. Yeah, let’s call it that. It’s a developing situation. Problem In the beginning of September, a…Continue reading (Literally) Breaking: Changes to app authentication on SharePoint! 😵

Azure Active Directory, the advanced logo

How to fix “AADSTS50011 – The resource principal named was not found in the tenant”

Another day, another variant of AADSTS50011! With a lot of apps and web services using Azure Active Directory for authentication, you’re bound to run into issues, right? Ah well, one would hope to avoid them. But at least this one is usually easy to fix! Problem I’ve encountered 2 different variants of this particular issue – the error message may or may not contain the name of the principal it’s looking for, and the guid of the tenant it’s looking for the principal in. AADSTS500011…Continue reading How to fix “AADSTS50011 – The resource principal named was not found in the tenant”

MSDN-related queries in my Google Search Console data. There's quite a few...

The all-important MSDN Subscriber links

This article serves as a simple glossary of important MSDN Subscriber links that I always forget – links that Microsoft keeps updating, that is! I’ll be updating the post as need be :) And yes, I do feel a little bit ridiculous about creating an actual article about something as simple as a list of links to stuff that should be easily discoverable by any search engine. But I suppose it is what it is. Anyway, it seems to me like any time I need…Continue reading The all-important MSDN Subscriber links

Visual Studio logo

How to restore lost windows in Visual Studio?

This article explains how to restore any hidden windows in Visual Studio without resetting your whole window layout, by using a common keyboard shortcut. Problem We’ve all been there – you’re opening a new window in Visual Studio, but your keyboard shortcut or clicking the item in the menu simply seems to do nothing. The window doesn’t show up anywhere. Reason The reason for this (most of the time) is simple: you have the window popped-up and located outside your screen. This happens pretty much…Continue reading How to restore lost windows in Visual Studio?

Dependency hell

How to resolve “Microsoft.Data.SqlClient is not supported on this platform.” in an Azure Function App?

Hah – another interesting one. This article describes how to resolve an error along the lines of “Microsoft.Data.SqlClient: Microsoft.Data.SqlClient is not supported on this platform.“, thrown by Azure Functions host. Apparently you can run into this issue either on your local development machine or even in Azure. Problem For me, this error popped up after some house cleaning tasks – dependency updates, merging feature branches… You know the stuff. And suddenly, while the Azure Function App would build and run just fine, my SQL calls…Continue reading How to resolve “Microsoft.Data.SqlClient is not supported on this platform.” in an Azure Function App?

T-SQL, yes please!

How to verify connection to database in Entity Framework Core?

This article explains how to perform a very simple and lightweight database connection test for an existing database context. A while ago, I needed to develop a simple API that I can poll from a load balancer to see whether: An Azure service hosting it is up and It has a connection to its SQL database This simple API would be used for monitoring purposes – simple stuff, sure, but what’s the best way to implement this without causing any unnecessary load to the database,…Continue reading How to verify connection to database in Entity Framework Core?

Entity Framework Core logo

How to resolve persistent “Build started… Build failed.” when trying to run Entity Framework Core commands?

This time, I’m happy to present you perhaps the simplest way of fixing an annoying and persistent issue with a misleading error message! Wait, does that sound familiar? It’s almost like that’s what half of my articles are about… Anyway, I was happily going my way about creating a couple of new fields to an entity and then scaffolding my changes to a new migration using Entity Framework Core’s Add-Migration, but this happened: Build started… Build failed. “Oh”, I thought. “I must have messed something…Continue reading How to resolve persistent “Build started… Build failed.” when trying to run Entity Framework Core commands?

WHAT IN TARNATION EF CORE?

How to resolve another “An error occurred while updating the entries” exception in Entity Framework Core

This article offers yet another possible fix to an issue, where trying to call SaveChanges() in Entity Framework Core throws a pretty generic “An error occurred while updating the entries”-exception, and you’re left wondering what in tarnation is wrong this time. And admittedly, that’s a really generic error, so it could be pretty much whatever. But in this article, I’ll go through one possibility – hopefully it helps! Problem So I was just pushing in some new rows to an incredibly simple table in my…Continue reading How to resolve another “An error occurred while updating the entries” exception in Entity Framework Core

One does not simply use just one DbContext with multiple ConnectionStrings in Entity Framework Core.

How to implement multiple Connection Strings for one DbContext in EF Core?

Recently, while building an app service to host a .NET Core API, I had to implement the logic for using both Read-Only and Read-Write Database Contexts for Entity Framework Core. In this particular case, it was the same database – just different contexts, because depending on the location of the app service the app was deployed in, read and write operations might actually go to different database instances, That’s really easy, right? Well… Yes and no. Essentially, it’s easy to spin up, but comes with…Continue reading How to implement multiple Connection Strings for one DbContext in EF Core?

AppInsights logo

How to fix weird “Production Breakpoints” errors in an Azure App Service?

This article describes a curious fix I found to an issue where Application Insights (seemingly) crashes your Azure App Service, leaving behind interesting and non-descriptive errors in the Application Event Logs. Problem Does your Application Insights look like this, too? Event logs full of “Production Breakpoints” with weird errors about named pipes? In my case, the errors were something like these below: IfFailRet(pNamedPipe->Read((BYTE*)&controlRequest, sizeof(SnapshotHolderControlStruct))) failed in function CSnapshotHolder::HandleNewPipeConnection: -2147024787 And: CNamedPipe::Read – Read from named pipe failed: 0x8007006D. These errors would always pop up at…Continue reading How to fix weird “Production Breakpoints” errors in an Azure App Service?

C# & .NET

How to get the EF Core Connection String?

A while ago, I had a situation where a DbContext was misbehaving after deployed to an Azure App Service, and I needed to check the connection string it’s using directly in the code. I had reason to think my code was grabbing an outdated connection string and using a wrong database – and as you can probably imagine, that could cause some issues! However, finding the right method actually took me googling, as there were plenty of examples for Entity Framework for .NET Framework, but…Continue reading How to get the EF Core Connection String?

Azure DevOps - Always Be Shipping!

Fun with Azure DevOps NuGet package versioning!

This article will briefly explain the different NuGet package versioning schemes – both automatic and manual – available. Then we’ll take a look at how to implement a nifty, and quite frankly, downright elegant automatic versioning scheme for your NuGet packages. Okay – returning from quite a trip down another rabbit hole, I think it’s a good time to document some of my findings in regards to Azure DevOps NuGet package versioning! This seems to be another area, where the documentation certainly does exist, but…Continue reading Fun with Azure DevOps NuGet package versioning!

Debugging. Yeah, that's roughly what the process looks like. With all those tiny symbols and all. Debug/Trace/Whatever.

Adding Debug listeners to your console application fails in .NET Core

Every now and then comes the need to write your console output to a log file. There’s a simple way to do this in .NET Framework, and quite a few online articles detailing a borderline one-liner on how to do achieve it: Adding a log file listener(s) by calling Debug.Listeners – something like this: TextWriterTraceListener tr1 = new TextWriterTraceListener(System.Console.Out); Debug.Listeners.Add(tr1); TextWriterTraceListener tr2 = new TextWriterTraceListener(System.IO.File.CreateText(“Output.txt”)); Debug.Listeners.Add(tr2); Source However, this doesn’t work in .NET Core anymore. Problem: Everything changes in .NET Core Using the code offered…Continue reading Adding Debug listeners to your console application fails in .NET Core

Microsoft SQL Server logo

How to access local MSSQL server using SQL Server Management Studio?

Every now and then you run into a situation, where you really need to run some SQL against your local development database. That database, at least in my case, is hosted on your local SQL Server Express. Connecting to a local SQL Server should be a walk in a park, right? Eh, well… While using a connection string to connect to said DB is easy, you can’t do that with the SQL Server Management Studio. I wish you could, but hey – it is what…Continue reading How to access local MSSQL server using SQL Server Management Studio?

Entity Framework Core logo

How to instantiate your DbContext outside your Data project?

When you’re in your .NET Core project, it’s always easy: you just register your DbContext in ConfigureServices, and then inject it into whichever Page, View or Controller you might need it in. However, when you have another project or solution you’re working on and you’d still like to use the same DbContext and your entity classes in it, you have to find another way to do it! What should we do, then? Description Let’s first take a look at the use cases and tech stack.…Continue reading How to instantiate your DbContext outside your Data project?

Version Control problems

How to resolve “refusing to allow an integration to create or update .github/workflows/main.yml” on GitHub Desktop?

Ran into this one when trying to push my merge from upstream. I was adhering to my own instructions (see below for a link), but got the error (further below) that stopped me from using GitHub Desktop to push (sync) at all. Posts Related to “How to resolve “refusing to allow an integration to create or update .github/workflows/main.yml” on GitHub Desktop?”:The Scary Anatomy of a Microsoft License Fraud5 ways to enable Custom Scripts for a SharePoint site collectionSharePoint Home, Hub, Sites, Start… What?