Skip to content

Instantly share code, notes, and snippets.

View nulllogicone's full-sized avatar

Frederic Luchting nulllogicone

View GitHub Profile
@nulllogicone
nulllogicone / Update_StorageAccount_TLS_1_2.ps1
Last active November 14, 2023 09:02
PowerShell to update all Azure StorageAccounts to minimum TLS version 1.2
$subscriptionId = "<your subscription id here>"
Connect-AzAccount -Subscription $subscriptionId
$storageAccounts = Get-AzStorageAccount
foreach ($account in $storageAccounts) {
$resourceDetails = Get-AzResource -ResourceId $account.Id
if ($resourceDetails.Properties.minimumTlsVersion -ne "TLS1_2") {
Write-Output "Updating TLS version for storage account: $($account.StorageAccountName)"
@nulllogicone
nulllogicone / ApplicationInsightsStaticClientRequestFilter.cs
Created July 5, 2020 18:16
Filter ApplicationInsights Static Client Requests
/// <summary>
/// I want to reduce noise in Application Insights.
///
/// Let's take this class as a blue print for customization
/// Todo: copy it to a GitHub Gist
/// https://blog.hildenco.com/2020/03/how-to-suppress-application-insights.html
///
/// To use this class you must add to Startup
/// services.AddApplicationInsightsTelemetryProcessor<ApplicationInsightsStaticClientRequestFilter>();
/// </summary>
@nulllogicone
nulllogicone / InitializeOnce.cs
Last active December 6, 2019 19:48
Can be used in a class that is expensive to initialize and only used occasionally
using System;
namespace OliUtil.Extensions
{
public abstract class InitializeOnce<TImpl>
where TImpl : InitializeOnce<TImpl>
{
protected abstract void Inititalize();
private readonly Lazy<TImpl> instance;
@nulllogicone
nulllogicone / ApplicationInsightsLogLevel
Last active October 26, 2019 19:10
appsettings configuration to send all Logger.LogInformation(messages) to ApplicationInsights
"Logging": {
"LogLevel": {
"Default": "Information",
"System": "Warning",
"Microsoft": "Warning" // does it skip the dotnet core informations? I hope so
},
"ApplicationInsights": {
"LogLevel": {
"Default": "Information", // should show all traces
"System": "Warning",
@nulllogicone
nulllogicone / MessageAuthentication.cs
Created October 11, 2019 08:21
Takes a message, adds an expiration and creates a HMAC signature and
using System;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Web;
namespace Nulllogicone.Utils
{
public static class MessageAuthentication
{