Skip to content

Instantly share code, notes, and snippets.

View astaykov's full-sized avatar

Anton Staykov astaykov

  • Microsoft (former Microsoft Azure MVP)
  • Berlin, Germany
  • X @astaykov
View GitHub Profile
astaykov / workflow.json
Created March 21, 2024 08:49
Logic App to check results of access review and execute termination workflow
"definition": {
"$schema": "",
"contentVersion": "",
"triggers": {
"Recurrence": {
"type": "Recurrence",
"recurrence": {
"frequency": "Day",
"interval": 1
astaykov / run.csx
Created March 19, 2024 07:30
Azure Function code for Entra ID custom authentication extension
#r "Newtonsoft.Json"
using System.Net;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Primitives;
using Newtonsoft.Json;
public static async Task<IActionResult> Run(HttpRequest req, ILogger log)
log.LogInformation("C# HTTP trigger function processed a request.");
string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
astaykov /
Last active November 24, 2023 16:42
list all resources in all available regions. filter by specific resource type. only for current account.
## Define the output CSV file
## List of resource types to include in the report
resource_types=("ec2" "lambda" "ecs" "eks" "rds" "dynamodb" "elasticmapreduce" "kinesis" "elasticache")
## Check if the AWS CLI is installed
if ! command -v aws &> /dev/null; then
astaykov /
Created October 17, 2023 08:20
List all azure function apps and then all functions within the function apps
az functionapp list --query "[].{n:name,g:resourceGroup}" -o Table
az functionapp list --query "[].{n:name,g:resourceGroup}" -o tsv | awk -F'\t' '{system("az functionapp function list -n "$1" -g " $2 " --query \"[].{g:resourceGroup,n:name,t:type}\" -o table")}'
using namespace System.Net
# Input bindings are passed in via param block.
param($Request, $TriggerMetadata)
function Parse-JWTtoken {
astaykov / SendgridCustomTemplateId.xml
Created November 18, 2022 09:25
Azure AD B2C custom e-mail with SendGrid - custom template id per locale
<TrustFrameworkPolicy xmlns:xsi=""
# First, connect to Azure AD
# Make sure there is no same policy already defined
# Get your policies and inspect them
# modify your gorup filter as appropriate
# ref:
$PolicyDefinitionString = "{
Connect-MgGraph -Scopes "Directory.AccessAsUser.All" -TenantId
Get-MgApplication -Filter "startswith(displayname,'Tonyco SaaS')" | ForEach-Object { Remove-MgApplication -ApplicationId $_.Id }
astaykov / UpdateAllUsers.ps1
Created August 31, 2022 06:06
Update all users in Azure AD
# This script is used to clean users' tenants association for a demo environment
$extProps = New-Object System.Collections.Generic.Dictionary"[String,String]"
Get-AzureADUser -all $true | ForEach-Object { Set-AzureADUser -ObjectId $_.ObjectId -ExtensionProperty $extProps }
astaykov /
Last active August 26, 2022 13:20
Update all web apps to TLS 1.2
#!/usr/bin/env bash
# first disable HTTP and force HTTPS only
az webapp list --query "[].id" --output tsv | az webapp update --https-only true --ids @-
# then force min-tls version
az webapp list --query "[].id" --output tsv | az webapp config set --min-tls-version '1.2' --ids @-
# then force FTPS in general.
# depending on your process, you might want to enforce FTPS (FtpsOnly) insted of completely disable it (Disabled).
az webapp list --query "[].id" --output tsv | az webapp config set --ftps-state FtpsOnly --ids @-