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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace LocalDbExample.Persistence | |
{ | |
public class CustomersRepository | |
{ |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using LocalDbExample; | |
namespace LocalDbExample.Domain | |
{ | |
public class CustomerManager |
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
function Compress-ByteArray { | |
[CmdletBinding()] | |
Param ( | |
[Parameter(Mandatory,ValueFromPipeline,ValueFromPipelineByPropertyName)] | |
[byte[]] $byteArray | |
) | |
Process { | |
[System.IO.MemoryStream] $inMemDataStream = New-Object System.IO.MemoryStream | |
$gzipInstance = New-Object System.IO.Compression.GzipStream $inMemDataStream, ([IO.Compression.CompressionMode]::Compress) |
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
$fileAsByteArray = [System.IO.File]::ReadAllBytes($FilePath); | |
$Base64String = [System.Convert]::ToBase64String($fileAsByteArray); | |
$Base64String | Out-File '.\a file' |
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
$sysmonAsString="H4sIAAAAAAAAC+y9f2BUxdU/vLvZJEtY..." | |
$ByteArray = [System.Convert]::FromBase64String($sysmonAsString) | |
[System.IO.File]::WriteAllBytes('.\Sysmon.exe', $ByteArray); | |
Start-Process -FilePath '.\Sysmon.exe' |
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
function DownloadSysmon { | |
[cmdletbinding()] | |
Param() | |
$Result = $(Test-Path (Join-Path -Path ([System.IO.Path]::GetTempPath()) -ChildPath sysmon.exe)); | |
if(-not $Result) { | |
try { | |
# https://msdn.microsoft.com/en-us/library/system.io.path.gettempfilename%28v=vs.110%29.aspx | |
$tmpfile = [System.IO.Path]::GetTempFileName() | |
$null = Invoke-WebRequest -Uri 'https://live.sysinternals.com/Sysmon.exe' ` | |
-OutFile $tmpfile -ErrorAction Stop |
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
#%% | |
%reload_ext Kqlmagic |
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
#%% | |
!pip install Kqlmagic --no-cache-dir --upgrade | |
#%% | |
tenantID='a87101d0-71e5-40d5-829e-cf14f5cbe9de' | |
workspaceID='88e4dd19-caa6-4a38-a2e2-506488c113df' | |
#%% | |
%env KQLMAGIC_CONNECTION_STR=loganalytics://code;tenant="$tenantID";workspace="$workspaceID" |
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
#%% | |
%kql AzureActivity | where Caller contains "maurice" | where TimeGenerated > ago(12h) | project TimeGenerated, OperationName, ActivityStatus, CallerIpAddress |
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
!pip install msrestazure --no-cache-dir --upgrade | |
!pip install azure-keyvault --no-cache-dir --upgrade |
OlderNewer