Skip to content

Instantly share code, notes, and snippets.

Avatar

Paul Batum paulbatum

  • Microsoft
  • Redmond, WA
View GitHub Profile
@paulbatum
paulbatum / $readme.md
Last active Sep 2, 2021
secretless-azure-functions
View $readme.md

Creating a Secretless Function App using Managed Identity

My goal is to make a fully secretless function app, and then add triggers for an Azure Storage queue and a Service Bus queue.

Step 1: Create the Function App without Azure Files

The first step is to create the function app, and configure it without Azure Files (because Azure Files doesn't support managed identity for SMB file shares). There is some documentation on this here. The portal doesn't provide that option today, but I can take the ARM template generated by the portal and modify it for my needs. So I go the through the create wizard, but instead of hitting Create, I hit the template button:

image

View functions-eventhubs-appinsights-queries.kql
// Query Notes
// -------------
// 1. This query display detailed information for Event Hub triggered functions using telemetry emitted by the Event Hubs extension 4.2.0 and greater.
//
// 2. The data is only emitted in the correct format if batched dispatch is used i.e. the function accepts multiple events for each execution. This is the recommended way to write Event Hub triggered functions. For an example see the documentation https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-event-hubs-trigger?tabs=csharp
//
// 3. If sampling is enabled in Application Insights, then there might be gaps in the data. To configure sampling see https://docs.microsoft.com/en-us/azure/azure-functions/configure-monitoring?tabs=v2#configure-sampling
//
// 4. The dispatchTimeMilliseconds value approximates the length of time between when the event was written to the event hub and when it was picked up by the Function App for processing. Note that:
// a) dispatchTimeMilliseconds could be negative or othe
@paulbatum
paulbatum / Function1.cs
Last active Jan 24, 2019
Event Hub Batch Example
View Function1.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Azure.EventHubs;
using Microsoft.Azure.WebJobs;
using Microsoft.Extensions.Logging;
namespace FunctionApp12
@paulbatum
paulbatum / gist:f7170955a46971456da2e69926af9d9d
Created Oct 19, 2018
Notification Hubs WebJobs SDK Extension error
View gist:f7170955a46971456da2e69926af9d9d
DryIoc.ContainerException
HResult=0x80131509
Message=Unable to get constructor of NotificationHubsExtensionConfigProvider using provided constructor selector when resolving singleton NotificationHubsExtensionConfigProvider: IExtensionConfigProvider {ServiceKey=DefaultKey(4), ReturnDefaultIfNotRegistered} #105
in wrapper IEnumerable<IExtensionConfigProvider> as parameter "registeredExtensions" #1
in singleton DefaultExtensionRegistryFactory: IExtensionRegistryFactory #52
from container.
Source=Microsoft.Azure.WebJobs.Script.WebHost
StackTrace:
at DryIoc.Throw.ThrowIfNull[T](T arg, Int32 error, Object arg0, Object arg1, Object arg2, Object arg3) in C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs:line 8939
at DryIoc.ReflectionFactory.CreateExpressionOrDefault(Request request) in C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs:line 6996
View host.json
{
"version": "2.0",
"extensions": {
"http": {
"maxConcurrentRequests": 1,
"maxOutstandingRequests": 4
}
}
}
View assemblyload.md

Assembly Resolution in Azure Functions

The goal of this post is to help .NET developers better understand assembly resolution and loading problems and limitations.

One common provide guidance on how to avoid or mitigate some of those issues, when possible, and go over some of the details on how this will be improved in the next version of Azure Functions.

In the following sections, we dive into the details of how things work today

View myfunctions.cs
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.Azure.WebJobs.Host;
namespace FunctionApp14
{
@paulbatum
paulbatum / Test1.cs
Created Dec 22, 2017
Example test project for testing the default http trigger in azure functions
View Test1.cs
using System;
using System.Diagnostics;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web.Http;
using FunctionApp22_UnitTesting;
using Microsoft.Azure.WebJobs.Host;
using Xunit;
@paulbatum
paulbatum / BCryptTest.cs
Created Nov 24, 2017
Functions Tiered Jit Test
View BCryptTest.cs
using System.IO;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.Azure.WebJobs.Host;
using Newtonsoft.Json;
namespace TieredJitTest