Here is how you can emulate Azure managed identity on your local system by running an instance metadata service identity endpoint and simulating the token API to return an access token from Azure CLI. You can use this for example to log into SQL Server Management studio using your Azure CLI identity, or locally test code that uses the "Azure only" [ManagedIdentityCredential](https://learn
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
# | |
# Powershell script for adding/removing/showing entries to the hosts file. | |
# | |
# Known limitations: | |
# - does not handle entries with comments afterwards ("<ip> <host> # comment") | |
# | |
$file = "C:\Windows\System32\drivers\etc\hosts" | |
function add-host([string]$filename, [string]$ip, [string]$hostname) { |
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
[CmdletBinding()] | |
param ( | |
[Parameter(Mandatory=$true)] | |
[string] | |
$ComputerName, | |
[int] | |
$Port = 443 | |
) |
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
* | |
{ | |
font-family:Calibri,sans-serif; | |
font-size:11pt; | |
} | |
p | |
{ | |
margin:0 0 8pt; | |
} | |
td p |
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 Get-WinEventXPathFilter | |
{ | |
<# | |
.SYNOPSIS | |
This function generates an xpath filter that can be used with the -FilterXPath | |
parameter of Get-WinEvent. It may also be used inside the <Select></Select tags | |
of a Custom View in Event Viewer. | |
.DESCRIPTION | |
This function generates an xpath filter that can be used with the -FilterXPath | |
parameter of Get-WinEvent. It may also be used inside the <Select></Select tags |
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
# Copyright: (c) 2020, Jordan Borean (@jborean93) <jborean93@gmail.com> | |
# MIT License (see LICENSE or https://opensource.org/licenses/MIT) | |
#Requires -Module MSAL.PS | |
Function New-EXOPSSession { | |
<# | |
.SYNOPSIS | |
Will open a PSSession to Exchange Online. |
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
filter Select-StringMatch { | |
<# | |
.SYNOPSIS | |
A companion to select-string to quickly fetch the value of a capture group, named or indexed | |
.DESCRIPTION | |
With -replace or -match we have the simple $matches['group'] syntax, but this doesn't really exist for Select-String | |
and the typical options are not pipeline friendly. The default object returned from Select-String is not that friendly | |
either if all you want is the value(s) of a capture group to then pipe to another command. This is basically a pipeline | |
friendly version of $matches. |
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
#requires -version 7 | |
#You can load this script with $(iwr https://tinyurl.com/TraceAICommand | iex) | |
using namespace Microsoft.ApplicationInsights | |
using namespace Microsoft.ApplicationInsights.Extensibility | |
using namespace Microsoft.ApplicationInsights.DataContracts | |
using namespace System.Management.Automation | |
using namespace System.Collections.Generic | |
using namespace System.Net | |
#Reference: https://docs.microsoft.com/en-us/azure/azure-monitor/app/console |