This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$tenantId = "00000000-0000-0000-0000-000000000000" # Replace with your tenant ID | |
$graphApiAppId = "00000003-0000-0000-c000-000000000000" # Well known ID | |
$msiName = "MSINAME" # Name of your managed identity e.g. name of Function or Logic App | |
$graphPermissions = @("Directory.Read.All", "User.Read.All") # Add or remove permissions | |
Connect-AzureAD -TenantId $tenantId | |
$msi = Get-AzureADServicePrincipal -Filter "displayName eq '$msiName'" # Can take a few seconds, add a sleep if necessary | |
$graphApiAppRegistration = Get-AzureADServicePrincipal -Filter "appId eq '$graphApiAppId'" | |
$appRoles = $graphApiAppRegistration.AppRoles | Where-Object { $graphPermissions -contains $_.Value -and $_.AllowedMemberTypes -contains "Application" } | |
foreach ($appRole in $appRoles) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$storageTable = (Get-AzStorageTable -Context $storageContext -Name $storageTableName).CloudTable | |
$resources = Search-AzGraph -Query 'where type !in ("microsoft.compute/virtualmachines/extensions", "microsoft.compute/restorepointcollections", "microsoft.portal/dashboards")| project id, name, location, resourceGroup, properties.storageProfile, properties.hardwareProfile, type' -First 2000 | |
foreach ($res in $resources) { | |
$properties = $res.PSObject.Properties | |
$tableEntry = @{} | |
foreach ($prop in $properties) { | |
if ($prop.value) { | |
$tableEntry.add($prop.name, $prop.value) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"description": "Analyze API call result.", | |
"type": "object", | |
"properties": { | |
"status": { | |
"description": "Status of the analyze operation.", | |
"enum": [ | |
"success", | |
"partialSuccess", | |
"failure" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", | |
"contentVersion": "1.0.0.0", | |
"parameters": { | |
"vmName": { | |
"type": "string", | |
"defaultValue": "proxyVm", | |
"metadata": { | |
"description": "Name of the VM" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<#PSScriptInfo | |
.GUID 0c6df4be-ff4b-481f-a7eb-31637849e580 | |
.VERSION 1.0 | |
.AUTHOR Jan-Henrik Damaschke | |
.COMPANYNAME Visorian GmbH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hexo list post | sls '^(\d*-\d*-\d*)[ ]{2}([\w\s-_\\\/.,()]+?)[ ]{2,}([\w\s-_\\\/.,()]+?)[ ]{2,}([\w\s-_\\\/.,()]+?)([ ]{2,}([\w\s-_\\\/.,()]+?))*$' -allmatches | % {[array]$postList += [pscustomobject]@{'Date' = [DateTime]::Parse($_.matches.groups[1].value);'Title' = $_.matches.groups[2].value; 'Path' = $_.matches.groups[3].value; 'Categories' = $_.matches.groups[4].value; 'Tags' = $_.matches.groups[6].value }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$target = '8.8.8.8' | |
$udpPort = 53 | |
$packetSize = 64 | |
### Using UdpClient | |
[byte[]]$packet = [byte[]]::new($packetSize) | |
$udpClient = [System.Net.Sockets.UdpClient]::new() | |
$udpClient.Client.ReceiveTimeout = 1000 | |
$ipEndPoint = [System.Net.IPEndPoint]::new([System.Net.IPAddress]::Any, 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$socket = [System.Net.Sockets.Socket]::new([System.Net.Sockets.AddressFamily]::InterNetwork, [System.Net.Sockets.SocketType]::Raw, [System.Net.Sockets.ProtocolType]::Icmp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum SyslogSeverity | |
{ | |
Emergency = 0 | |
Alert = 1 | |
Critical = 2 | |
Error = 3 | |
Warning = 4 | |
Notice = 5 | |
Informational = 6 | |
Debug = 7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Test to write messages to current pipeline. Can be used when in other scope or runspace. | |
param($msg) | |
$runspace = [System.Management.Automation.Runspaces.Runspace]::DefaultRunspace | |
$command = 'Write-Verbose "{0}"' -f $msg | |
$runspace.CreateNestedPipeline($command, $false).Invoke() |
NewerOlder