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-InstalledModuleFast { | |
param( | |
#Modules to filter for. Wildcards are supported. | |
[string]$Name, | |
#Path(s) to search for modules. Defaults to your PSModulePath paths | |
[string[]]$ModulePath = ($env:PSModulePath -split [System.IO.Path]::PathSeparator), | |
#Return all installed modules and not just the latest versions | |
[switch]$All | |
) |
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 Invoke-GhAction { | |
param( | |
$RepoName, | |
$Path, | |
$Method = 'GET', | |
$Body, | |
$BaseUri = 'https://api.github.com/repos' | |
) | |
$irmParams = @{ |
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 New-AzureDeploy { | |
<# | |
.SYNOPSIS | |
Creates an Azure Deploy Button link for a given ARM template. | |
#> | |
param( | |
#Path to the ARM json template file that is publicly hosted and accessible. This cannot be a bicep template. | |
[string]$Uri, | |
#Path to a UI Definition JSON file. https://aka.ms/masandbox to create one. | |
[string]$FormDefinitionUri |
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
param workspaceName string | |
param logRetentionDays int = 90 | |
param tableNames array = [ | |
'ASimNetworkSessionLogs' | |
'ASimAuthenticationEventLogs' | |
'ASimWebSessionLogs' | |
'ASimAuditEventLogs' | |
'ASimDhcpEventLogs' | |
'ASimDnsActivityLogs' | |
'ASimFileEventLogs' |
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 namespace System.Collections.Generic | |
using namespace System.Management.Automation | |
using namespace System.Text | |
Function Send-AzMonitorLog { | |
[CmdletBinding()] | |
param( | |
[Parameter(Mandatory)] | |
[string]$Endpoint, |
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 Watch-UBreakIFix ($TrackingCode) { | |
while ($true) { | |
$result = foreach ($code in $TrackingCode) { | |
$response = Invoke-RestMethod "https://www.ubreakifix.com/api/v1/tracker/info?code=$code" | |
$status = $response.work_orders.work_order_status | |
[PSCustomObject]@{ | |
'Customer' = $response.customer.full_name | |
'Device' = $response.work_orders.device.device_type.name | |
'Fixer' = $response.user.email | |
'Status' = $status.name |
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 -Module Az.Accounts | |
$verbosePreference = 'continue' | |
function ConvertFrom-JWTtoken { | |
<# | |
.NOTES | |
Lovingly borrowed from: https://www.michev.info/blog/post/2140/decode-jwt-access-and-id-tokens-via-powershell | |
#> | |
[cmdletbinding()] | |
param([Parameter(Mandatory = $true)][string]$token) | |
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 -module Az.Functions | |
function Write-CmdletError { | |
param($message, $cmdlet = $PSCmdlet) | |
$cmdlet.ThrowTerminatingError( | |
[Management.Automation.ErrorRecord]::new( | |
$message, | |
'CmdletError', | |
'InvalidArgument', |
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 namespace Microsoft.Azure.PowerShell.Cmdlets.Monitor.DataCollection.Models | |
using namespace System.Management.Automation | |
function New-JAzDataCollectionRule { | |
<# | |
.SYNOPSIS | |
Create a new Data Collection Rule in Azure Monitor. Uses 2023 API for direct DCRs | |
.NOTES | |
The MS Documentation on this sucks but the reference has a good example which is how I figured it out: https://learn.microsoft.com/en-us/rest/api/monitor/data-collection-rules/create?view=rest-monitor-2023-03-11&tabs=HTTP#create-or-update-data-collection-rule-with-embedded-ingestion-endpoints | |
#> |
NewerOlder