~/.azure/config
[core]
output = table
alias wrap='tput smam'
~/.azure/config
[core]
output = table
alias wrap='tput smam'
| # The assignment is neede to treat the return value of sed as array | |
| IFS=$'\n' pictures=($(cat /home/mbatsching/git/abtis-cmp/deploy/powerbi/powerbi-update-datasource-credentials.template.html | grep img | sed -E 's/.*img src="([^"]+)".*/\1/g')) |
| [CmdletBinding(SupportsShouldProcess)] | |
| param ( | |
| # Path to the script with "requires module" statements | |
| [Parameter(Mandatory)] | |
| [string] | |
| $Path | |
| ) | |
| $dependencies = Get-ChildItem $Path | | |
| Select-String -Pattern "^#Requires -Module (@{ ModuleName = '[^']+'; RequiredVersion = '[0-9.]+';? })" | |
function Start-Ranger {
[CmdletBinding()]
param (
[Parameter()]
[string]
$Path = $pwd.PathHaven't you always wondered how to bring Sergio Lepore's wonderful ChristBASHTree to PowerShell?
For this to work you need:
az storage entity merge --entity PartitionKey=$user RowKey=$user Active="false" --table-name AcademyUser --account-name sajedoxlab8idgyu4918ojPadding a Number with zeros:
j=12
Academy${(l:3::0:)j}
# ==> Academy012Use arithmetic evaluation:
Az CLI has many advantages over the Az PowerShell modules, but natively it does not integrate very nicely with PowerShell scripts. That is mainly because of two reasons:
Both problems can be tackled with a very simple wrapper function:
function paz {Add the following to your profile:
how()
{
command="${@//[ ]/+}"
curl cheat.sh/"$command"
print -S "`curl -s cheat.sh/\"$command?QT\"`"
}Imagine you have a policy to not keep files on an azure file share that are older than a specified time, lets say 5 days.
The Az.Storage powershell module provides the cmdlet Get-AzStorageFile that can be used to retrive the files from an Azure file share, but there are two shortcomings of this cmdlet, that makes our task a bit difficult (at least in the module's current version when writing this article: 5.1.0):
Get-AzStorageFile on this folder, if you want to list it's content.FetchAttributes() method to fill this attributes with value.Fortunately PowerShell 7 makes it relatively easy to address both problems with a simple wrapper function: