https://bizmonger.wordpress.com/2018/12/23/feature-toggles-client/ Blog Post https://www.slideshare.net/ScottNimrod/trunkbased-development-with-feature-toggles Slide Deck
How to Create a Bearer Token
Intro Here's the code that I learned to create for generating an authorization token: Writing the Test The following test was written to generate a bearer token: [<Test>] let ``get authorization token``() = let section = ConfigurationManager.GetSection("section.bearerToken") :?> NameValueCollection; let kvPairs = section.AllKeys.Select(fun k -> new KeyValuePair<string, string>(k, section[k])); let tenantId = kvPairs.Single(fun v -> …
F#: When HttpClient PostAsJsonAsync no longer works
Intro I recently upgraded all of the NuGet packages inside my Visual Studio solution. The result was breaking changes at runtime. Specifically, HttpClient::PostAsJsonAsync was resulting in an empty JSON value. The following HttpClient::PostAsJsonAsync example of such code: use client = httpClient baseAddress let encoded = Uri.EscapeUriString(resource) let! response = client.PostAsJsonAsync(encoded, payload) |> Async.AwaitTask Here are …
Continue reading "F#: When HttpClient PostAsJsonAsync no longer works"
Pulumi: How can a Function App reference a connection string from a SQL Server Database declaration?
Using Pulumi, I recently learned how to obtain a connection string from SQL Server database declaration. I needed this connection string so that I could register its value in an App Setting. I learned that Pulumi provides the ConnStringInfoArgs type to accommodate this need. Here's some example code below: using System; using Pulumi; using Pulumi.AzureNative.Resources; …
Pulumi: Function App, Key Vault, and Access Policy
My Brain Dump How can a Function App access Azure Key Vault secrets? Known Issue and workaround: I referenced the issue I was observing and used the recommended work around. Below is the workaround. Function App First, provide an identity value to the Function App declaration: Identity = new FunctionAppIdentityArgs { Type = "SystemAssigned" }, …
Continue reading "Pulumi: Function App, Key Vault, and Access Policy"
Pulumi Code Examples
My hobby project consists of building a mobile delivery platform. Thus, I needed some Infrastructure as Code (aka: IaC) to provision deployments. My goal was to have code structured as follows: Fortunately, I was able to learn the basics and write the proof of concept in a short amount of time. Here's some clients to …
F#: Azure Service Bus (Topic Subscription)
Azure Topic Listener namespace Notifications.DataGateway open System open System.Text open System.Diagnostics open System.Threading.Tasks open Azure.Messaging.ServiceBus open Newtonsoft.Json open Notifications.DataTransfer open Notifications.DataGateway type AzureTopicListener<'T>(subscriptionInfo:SubscriptionInfo) as x = let topic = subscriptionInfo.Topic let subscription = subscriptionInfo.Subscription let connectionString = subscriptionInfo.ConnectionString let requested = Event<_>() let mutable serviceBusClient : ServiceBusClient = null let mutable processor : ServiceBusProcessor = …
Continue reading "F#: Azure Service Bus (Topic Subscription)"
F# Domain Modeling: IRS Tax Form 8889
I've discovered that IRS tax forms can serve as mind-numbing code katas. I attempted to domain model HSA Form 8889 in F#. The code can be found on my GitHub account. Language namespace HSATaxForm_2020 open System module rec Language = module InEligible = type Coverage = Medicare | TriCare | TriCareLife type Amount = float …
F#: Extract key value pairs from an app config file
The following snippet extracts key value pairs from the AppSettings section of an app config file: let appSettings = ConfigurationManager.AppSettings let serviceKeys = ConfigurationManager.AppSettings.AllKeys |> Seq.filter (fun k -> k.ToString().EndsWith "Fn") |> Seq.map (fun k -> (k,appSettings.GetValues(k).First())) <appSettings> <add key="MyAzureFn" value="some_value_1"/> <add key="MyOtherAzureFn" value="some_value_2"/> <add key="MyThirdAzureFn" value="some_value_3"/> </appSettings>
Deploying Azure SignalR
Update the upstream URL pattern so that it contains the SignalR extension key: The SignalR extension key can be found under App Keys: Appendix: using System.Threading.Tasks; using Microsoft.Azure.WebJobs; using Microsoft.Azure.WebJobs.Extensions.Http; using Microsoft.AspNetCore.Http; using Microsoft.Azure.WebJobs.Extensions.SignalRService; using Microsoft.AspNetCore.SignalR; using Microsoft.Extensions.Logging; using static AzureSignalR.LocationReporting.Language; namespace AzureSignalR.Functions { public class LocationHub : ServerlessHub { const string NewMessageTarget = "newMessage"; …