Skip to content

Instantly share code, notes, and snippets.

View anderseide's full-sized avatar

Anders Eide anderseide

View GitHub Profile
@override
public onListViewUpdated(event: IListViewCommandSetListViewUpdatedParameters): void {
const commandOne: Command = this.tryGetCommand('COMMAND_ONE');
const commandTwo: Command = this.tryGetCommand('COMMAND_TWO);
const commandThree: Command = this.tryGetCommand('COMMAND_THREE');
// Hide commands by default
commandOne.visible = false;
commandTwo.visible = false;
commandThree.visible = false;
@anderseide
anderseide / mg-deploy-soft-delete-and-purge-protection.json
Created August 17, 2020 06:28
mg-deploy-soft-delete-and-purge-protection
{
"$schema": "https://schema.management.azure.com/schemas/2019-08-01/managementGroupDeploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"functions": [],
"variables": {},
"resources": [
{
"name": "deploy-soft-delete-and-purge-protection",
"type": "Microsoft.Authorization/policyDefinitions",
@anderseide
anderseide / get-build-state.yml
Created December 12, 2019 19:51
azure-devops-pipeline-build-state
- task: PowerShell@2
inputs:
targetType: inline
script: |
$systemAccessToken = $env:SYSTEM_ACCESSTOKEN
$pipelineDefinitionId = $env:PIPELINE_DEFINITION_ID
$projectBaseUrl = $env:PROJECT_BASE_URL
$uri = "$($projectBaseUrl)/_apis/build/builds?api-version=5.1&definitions=$($pipelineDefinitionId)&queryOrder=queueTimeDescending&`$top=1"
$headers = @{"Authorization" = "Bearer $systemAccessToken"}
@anderseide
anderseide / stripped-down-schema-for-azure-devops-service-hook-events.json
Created August 5, 2019 14:09
A stripped down schema for the Azure DevOps Service Hooks event sendt when you configure a web hook
{
"properties": {
"createdDate": {
"type": "string"
},
"detailedMessage": {
"type": "object"
},
"eventType": {
"type": "string"
@anderseide
anderseide / generate-event-hub-sas-token.ps1
Last active August 5, 2019 11:08
Generate Event Hub SAS token
[Reflection.Assembly]::LoadWithPartialName("System.Web")| out-null
$URI="[ADD_YOUR_EVENT_HUB_NAMESPACE].servicebus.windows.net/myeventhub"
$Access_Policy_Name="RootManageSharedAccessKey"
$Access_Policy_Key="[ROOT_MANAGED_SHARED_ACCESS_KEY]"
#Added $UntilTokenExpireInSeconds instead of the 300 seconds example from docs.microsoft.com
$UntilTokenExpireInSeconds = 60*60*24*365
$Expires=([DateTimeOffset]::Now.ToUnixTimeSeconds())+$UntilTokenExpireInSeconds
$SignatureString=[System.Web.HttpUtility]::UrlEncode($URI)+ "`n" + [string]$Expires
$HMAC = New-Object System.Security.Cryptography.HMACSHA256
$HMAC.key = [Text.Encoding]::ASCII.GetBytes($Access_Policy_Key)