Skip to content

Instantly share code, notes, and snippets.

View helplessJ's full-sized avatar

JakeH6k helplessJ

  • Whidbey Island
View GitHub Profile
@AlexFilipin
AlexFilipin / AzureAutomationGraph.ps1
Last active September 20, 2023 22:31
Azure Automation Managed Identity Graph Access
# Assign Graph application permissions to managed identity (outside of Azure Automation)
$spID = "c3bfc803-bc8a-47af-a8a4-eed98dce8bca" #Managed Identity SP
$PermissionName = "User.Read.All"
$GraphServicePrincipal = Get-MgServicePrincipal -Filter "startswith(DisplayName,'Microsoft Graph')" | Select-Object -first 1 #Graph App ID: 00000003-0000-0000-c000-000000000000
$AppRole = $GraphServicePrincipal.AppRoles | Where-Object {$_.Value -eq $PermissionName -and $_.AllowedMemberTypes -contains "Application"}
New-MgServicePrincipalAppRoleAssignment -AppRoleId $AppRole.Id -ServicePrincipalId $spID -ResourceId $GraphServicePrincipal.Id -PrincipalId $spID
$AppRoleAssignments = Get-MgServicePrincipalAppRoleAssignment -ServicePrincipalId $spID
# Please note you can also give an managed identity permissions via:
# Role assignments, such as User Administrator scoped to an Administrative Unit
@jirfag
jirfag / Dockerfile
Last active June 1, 2021 03:20
Kubernetes PostgreSQL backups
FROM python:alpine
RUN pip install --no-cache-dir awscli
RUN apk update && apk add postgresql
COPY dumpDb.sh .
ENTRYPOINT [ "/bin/sh" ]
CMD [ "./dumpDb.sh" ]