# Managing Azure Functions via PowerShell Cmdlets
# Prerequisites:
# - PowerShell Core 6 or greater --> https://github.com/PowerShell/PowerShell/releases
# - Core Tools --> https://github.com/Azure/azure-functions-core-tools#installing
# - Az.Functions preview module --> https://www.powershellgallery.com/packages/Az.Functions/0.0.2-preview
# Install Azure Functions PowerShell core module
Install-Module -Name Az.Functions -AllowPrerelease
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
#require -version 5.1 | |
#Usage: iwr https://tinyurl.com/VSCodeServer | iex | |
#Parameterized usage: & ([ScriptBlock]::Create((iwr https://tinyurl.com/VSCodeServer))) -Your -Options | |
param( | |
#Path to install the vscode binary to. This defaults to a folder in your Local AppData path. Must be writable by your current user without sudo | |
[ValidateNotNullOrEmpty()] | |
[string]$InstallPath = $(Join-Path -Path ([System.Environment]::GetFolderPath('LocalApplicationData')) -ChildPath 'vscode-cli'), | |
#Installation architecture. This is normally autodetected. | |
$Arch, | |
$OS, |
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
Event | |
| where EventID == "4104" | |
| extend ParsedEvent = parse_xml(strcat("<root>", ParameterXml, "</root>")) | |
| extend MessageNumber = tolong(ParsedEvent.root.Param[0]) | |
| extend MessageTotal = tolong(ParsedEvent.root.Param[1]) | |
| extend ScriptBlockElement = iff( | |
strlen(tostring(ParsedEvent.root.Param[2]["#text"])) > 0, | |
ParsedEvent.root.Param[2]["#text"], | |
ParsedEvent.root.Param[2]) | |
| extend ScriptBlockId = tostring(ParsedEvent.root.Param[3]) |
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
# Personal preference. I like landing on the Desktop | |
Set-Location $Env:USERPROFILE\Desktop | |
$currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent()) | |
# If the current session is elevated, prefix the prompt with '[Admin]' | |
if ($currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { | |
Set-Item -Path Function:\prompt -Value "`"[Admin] PS $($executionContext.SessionState.Path.CurrentLocation)$('>' * ($nestedPromptLevel + 1)) `"" | |
} |
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/2019-04-01/deploymentTemplate.json#", | |
"contentVersion": "1.0.0.0", | |
"parameters": { | |
"databaseAccount_free_tier_name": { | |
"defaultValue": "my-cosmos-account-name", | |
"type": "String" | |
} | |
}, | |
"variables": {}, |
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
$currentContext = Get-AzContext | |
$azureRmProfile = [Microsoft.Azure.Commands.Common.Authentication.Abstractions.AzureRmProfileProvider]::Instance.Profile | |
$azureRmProfileClient = [Microsoft.Azure.Commands.ResourceManager.Common.RMProfileClient]::new($azureRmProfile) | |
$azureRmProfileClient.AcquireAccessToken($currentContext.Subscription.TenantId) |
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
$AutoLoggerName = 'MyAMSILogger' | |
$AutoLoggerGuid = "{$((New-Guid).Guid)}" | |
New-AutologgerConfig -Name $AutoLoggerName -Guid $AutoLoggerGuid -Start Enabled | |
Add-EtwTraceProvider -AutologgerName $AutoLoggerName -Guid '{2A576B87-09A7-520E-C21A-4942F0271D67}' -Level 0xff -MatchAnyKeyword ([UInt64] (0x8000000000000001 -band ([UInt64]::MaxValue))) -Property 0x41 |