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
# set the expiry to a month ago | |
expirydate=$(date -d'-1 month' +%s) | |
# I can use az -o table with cut -d driectly | |
for snapshot in $(az snapshot list -g $resourceGroup | jq -r '.[] | [.id, .timeCreated[:10], .name] | join("#")') | |
do | |
snapshotId=$(echo $snapshot | cut -f1 -d "#") | |
snapshotDate=$(echo $snapshot | cut -f2 -d "#" | xargs -I{} date -d {} +%s) | |
snapshotName=$(echo $snapshot | cut -f3 -d "#") | |
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
param( | |
[string] $targetvariablename, | |
[int] $length | |
) | |
# create a list of characters to select from | |
$ascii=$null | |
for ($a = 33; $a -le 126; $a++) { | |
$ascii+=,[system.convert]::tochar($a) |
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
param ( | |
[Parameter(Mandatory=$true)][string]$ARMOutput | |
) | |
$json = $ARMOutput | convertfrom-json | |
$json.PSObject.Properties | ForEach-Object { | |
Write-Host "##vso[task.setvariable variable=$($_.name);]$($_.value)" | |
} |