This file contains hidden or 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-StrictMode { | |
[CmdletBinding()] | |
param ( | |
[Switch]$All | |
) | |
[Reflection.BindingFlags]$flags = 'Instance, NonPublic' | |
try { | |
# SessionStateInternal |
This file contains hidden or 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
# Logging verbose info to screen is useful for debugging | |
# but the info is hidden 99% of the time. Problem is that | |
# evaluating a string to get the verbose message will run | |
# even if we never actually print it, adding overhead to | |
# every run, not just runs that are verbose. | |
# to avoid this passing a script block that evaluates to the | |
# message string conditionally seems to work well | |
This file contains hidden or 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-ArgumentCompleter { | |
<# | |
.SYNOPSIS | |
Get custom argument completers registered in the current session. | |
.DESCRIPTION | |
Get custom argument completers registered in the current session. | |
By default Get-ArgumentCompleter lists all of the completers registered in the session. | |
.EXAMPLE | |
Get-ArgumentCompleter |
This file contains hidden or 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 Resolve-MemberChain | |
{ | |
param( | |
[Parameter(Mandatory = $true, ValueFromPipeline = $true)] | |
[psobject[]]$InputObject, | |
[Parameter(Mandatory = $true, Position = 0)] | |
[string[]]$MemberPath, | |
[Parameter(Mandatory = $false)] |
This file contains hidden or 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-AzCachedAccessToken { | |
<# | |
.SYNOPSIS | |
Get the Bearer token from the currently set AzContext | |
.DESCRIPTION | |
Get the Bearer token from the currently set AzContext. Retrieves from Get-AzContext | |
.EXAMPLE | |
Get-AzCachedAccesstoken |
This file contains hidden or 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 namespace Microsoft.Azure.Commands.Common.Authentication.Abstractions | |
using namespace System.Management.Automation.Language | |
using namespace System.Management.Automation | |
using namespace System.Collections.Generic | |
using namespace System.Collections | |
[AttributeUsage("Property,Field")] | |
class SubscriptionNameCompleter : ArgumentCompleterAttribute { | |
# PowerShell expects you to write IArgumentCompleter and register them with this syntax: | |
# [ArgumentCompleter([MyIArgumentCompleter])] |